I have code:
List<String> list = new ArrayList<String>();
list.add("10.160.0.100;14/Nov/201107:22:38;/;-;");
list.add("10.160.0.100;14/Nov/201108:54:31;/;-;");
list.add("10.160.0.10;16/Nov/201112:56:38;/;-;");
list.add("10.160.0.100");
list.add("10.160.0.100");
list.add("10.160.0.10");
Collections.sort(list);
for (String temp : list) {
System.out.println(temp);
}
Output is:
10.160.0.10
10.160.0.100
10.160.0.100
10.160.0.100;14/Nov/201107:22:38;/;-;
10.160.0.100;14/Nov/201108:54:31;/;-;
10.160.0.10;16/Nov/201112:56:38;/;-;
Why ? I need this output:
10.160.0.10
10.160.0.100
10.160.0.100
10.160.0.10;16/Nov/201112:56:38;/;-;
10.160.0.100;14/Nov/201107:22:38;/;-;
10.160.0.100;14/Nov/201108:54:31;/;-;