This content has been marked as final. Show 4 replies
If you had those "numbers" as Strings, that output is what you would see. So I conclude that you have those numbers as Strings.
You're sorting strings, not numbers, apparantly.
"1" (as a String) is 'less than' "15", which is 'less than' "2", etc.
If your collection actually had Integers in it instead of Strings, I bet it would work as you would expect it to.
Ya I didnt even think of that, you are correct. The reason I have it as strings is because they are not just numbers in the cells, its more like this.
so I have both, I guess my only choice is to make 2 arraylists? One with the words and one ints?
No, you should define a class that has 1 and "One" as fields. Make that class implement Comparable or provide a Comparator.