I want to sort a few strings:
RANDOM.XY
AAA.BBB.CC
AAA.BBB
RANDOM.XY.Z
AAA.BBB.CC.D
The sorted order should be:
AAA.BBB
AAA.BBB.CC
AAA.BBB.CC.D
RANDOM.XY
RANDOM.XY.Z
I put them in an ArrayList list, and used a built-in sort method:
Collections.sort(list);
However, what I get from the sorting is:
AAA.BBB.CC.D
AAA.BBB.CC
AAA.BBB
RANDOM.XY.Z
RANDOM.XY
How should I go about this?