Question about sorting in ArrayList
Lets say I have an ArrayList of books that holds some data about a few book's title, author and page count, and I want to ask the user if they want to sort by Title or Author or Page Count, is it possible to sort by using ArrayList or should I use simple Array? Because Title and Author will be sorting by String and Page Count will be sorting by integer, i just don't know if ArrayList can do that kind of sorting, i hope my question is understandable...
Re: Question about sorting in ArrayList
Look at the java.util.Collections class API and you'll find some sort methods that work well on ArrayLists. You'll likely need to use some Comparators to allow you to sort on different fields.