Custom Comparator
should help
Collections.sort(list, new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return s1.compareToIgnoreCase(s2);
}
});
Or if you are using Java 8:
list.sort(String::compareToIgnoreCase);
More Related Contents:
- Sorting an ArrayList of objects using a custom sorting order
- How to sort a List/ArrayList?
- How to sort an ArrayList in Java [duplicate]
- In Java how do you sort one list based on another?
- How to sort an ArrayList using multiple sorting criteria?
- Removing Duplicate Values from ArrayList
- How can I sort an ArrayList of Strings in Java?
- Sorting ArrayList of Objects by Object attribute
- Write a program that takes an array/arraylist of integer and finds longest sub array/arraylist whose entries are equal [closed]
- Exception in thread “main” java.lang.IndexOutOfBoundsException: Index: 6, Size: 6 [duplicate]
- How do I use Comparator to define a custom sort order?
- Java List.add() UnsupportedOperationException
- ConcurrentModificationException when adding inside a foreach loop in ArrayList [duplicate]
- How do I find out what type each object is in a ArrayList?
- From Arraylist to Array
- Sorting 2D array of strings in Java
- Java Sorting based on Enum constants
- Sort a List of objects by multiple fields [duplicate]
- Empty an ArrayList or just create a new one and let the old one be garbage collected? [duplicate]
- Hash Set and Array List performances
- How can I sort a JSONArray in JAVA [duplicate]
- Scanner skipping every second line from file [duplicate]
- JTable + Sorting specific field
- Can not deserialize instance of java.util.ArrayList out of VALUE_STRING
- Merging two arrayLists into a new arrayList, with no duplicates and in order, in Java
- Time Complexity for Java ArrayList
- ‘MergeSort Algorithm’ – What’s the better implementation in JAVA? [closed]
- java: Arrays.sort() with lambda expression
- ArrayList Generic without Type
- Iterate ArrayList in JSP