You can try something like this:
List<Book> books = new ArrayList<Book>();
Collections.sort(books, new Comparator<Book>(){
public int compare(Book o1, Book o2)
{
return o1.name.compareTo(o2.name);
}
});
More Related Contents:
- Write a function that will sort a string array using Java
- Sorting 2D array of strings in Java
- Difference between Object[] and Array of specific Objects in java
- Android String that change every day
- How do I print my Java object without getting “SomeType@2f92e0f4”?
- How to add new elements to an array?
- A quick and easy way to join array elements with a separator (the opposite of split) in Java [duplicate]
- How does the String class override the + operator?
- How to convert Java String into byte[]?
- java Arrays.sort 2d array
- Sort a two dimensional array based on one column
- string to string array conversion in java
- Why isn’t there a java.lang.Array class? If a java array is an Object, shouldn’t it extend Object?
- How do I convert a byte array to Base64 in Java?
- How to extract numbers from a string and get an array of ints?
- Java, find intersection of two arrays
- Why does println(array) have strange output? (“[Ljava.lang.String;@3e25a5”) [duplicate]
- Is Java 7 using Tim Sort for the Method Arrays.Sort?
- Error: Generic Array Creation [duplicate]
- Sort ArrayList of Array in Java
- Remove Null Value from String array in java
- How do I sort two arrays in relation to each other?
- Sort a single String in Java
- Difference between Arrays.sort() and Arrays.parallelSort()
- Sorting two arrays simultaneously
- Java equivalent to Explode and Implode(PHP) [closed]
- what is Ljava.lang.String;@
- Check if an array is sorted, return true or false
- How can I turn a JSONArray into a JSONObject?
- Java: Checking equality of arrays (order doesn’t matter)