Chapter
Sorted Collections
From ComputerScienceOne by Dr Chris Bourke
Concepts
- How does Java perform binary searches on arrays and lists?
"The Arrays class provides public static <T> int binarySearch(T[] a, T key, Comparator<T> c). That is, it takes an array of elements as well as key and a Comparator all of the same type T. It returns
- How does Java sort arrays and lists with comparators?
"As with searching, the Arrays and Collections classes provide parameterized sorting methods to sort arrays and Lists. In Java 6 and prior, the implementation was a hybrid merge/insertion sort. Java 7
- What are sorted collections in the Java Collections framework?
"The Java Collections framework also provides several sorted data structures. Though an ordered collection such as a List can be sorted calling the Collections.sort() method, a sorted data structure m