I have a Set of Strings in the order{This is the order in which sorting is to be done}
"Public","InternalUse","Confidential"
My requirement is that i Have to sort the column containing the above String Values in the order mentioned above.
For example: If I have
"Internal Use","Confidential","Public" as values in the column
After sorting it should be :
"Public", "InternalUse","Confidential"
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32688
4
posted
0
Can you create a Comparator which will support your sorting order?
Can you put your Strings as keys in a Map and return a Double which indicates the sorting order? Using a Double rather than Integer allows you to insert intermediate values later on.