Проблема заключается в том, что когда я переоткрываю файл, то сортировка меняется
Решение в том, что нужно использовать ListedHashTree, а не HashTree
/**
* ListedHashTree is a different implementation of the {@link HashTree}
* collection class. In the ListedHashTree, the order in which values are added
* is preserved . Any listing of nodes
* or iteration through the list of nodes of a ListedHashTree will be given in
* the order in which the nodes were added to the tree.
*
* @see HashTree
*/@link HashTree}
* collection class. In the ListedHashTree, the order in which values are added
* is preserved . Any listing of nodes
* or iteration through the list of nodes of a ListedHashTree will be given in
* the order in which the nodes were added to the tree.
*
* @see HashTree
*/