This is a Whizlabs example to prove the output sort sequence of a TreeSet. It outputs: "JSP
Java Swing XML" - the explanation is that this is ascii value order, but its not! XML(241) and should come after
JSP(237). It looks like a letter by letter ascii comparison rather than a total ascii value, is that right?
Whizlabs
test program:
To prove it programmatically (because I need practice on collections):
This outputs:
LinkedHashMap output, to prove ascii ordering of TreeSet:
195: AAA
386: Java
241: XML
520: Swing
237: JSP
Second question:
The LinkedHashMap output is in key input sequence, how can I output it in key sequence, in this case by numeric magnitude?
Thank you!