So I have an ArrayList
of object 'Book' (The Item objects contain data of Title, Author, ID) and the object class' getTitle()
method returns the title of the book as a string. How would I mergeSort
the existing ArrayList
into a new ArrayList
of 'Item' that's ordered Alphabetically by title?
I also need to create a method called searchTitle()
that takes user input of String as a parameter and uses binary searching to find the book title in the newly sorted list and then if it finds it, it will return the entire Item with the matching title.
I know how binary searching works I'm just not sure how I'm going to do that with the strings that the Book.getTitle()
method will return...