Sort Java List/Map by order in which items are in an XML File
- by Brandon Smith
Hello everyone,
What I'm looking to do is to sorta a Java List or Map in the order the items are in a XML File.
For Example
I have a list of function names as so:
functionOne
functionThree
functionTwo
The XML File looks like this:
<xml>
<function>functionOne</function>
<function>functionTwo</function>
<function>functionThree</function>
</xml>
So I would like to sort the list so the function names are as so:
functionOne
functionTwo
functionThree
Now Im trying to do this for Variables as well, so there are around 500+ unique 'items'.
Does anyone have any idea how I can go about doing this? Now for the file that determines that sort order doesn't have to be XML it just what I use the most, it can be anything that can get the job done.
Thanks in advance for your time.