When sorting or creating sorted collections, you can always specify your own instance of the object's Comparator
. That way you can alter the ordering of objects.
Is it possible to have a nonlexicographic order
-
07-07-2023 - |
Question
I searched it up but I couldn't find anything since I don't know the actual name to it. Is it possible to have a nonlexicographic order for example the Alphabet comes first before then numbers then symbols?
I know in java compareTo statement does it lexigraphic so is there a non-lexicographic order?
Solution
OTHER TIPS
You can write your own compareTo function for classes so you can order your objects anyway you want.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow