Annotated Outline of Collections Framework

The collections framework consists of:

  • Abstract Implementations - Partial implementations of the collection interfaces to facilitate custom implementations.

    • AbstractCollection - Skeletal implementation of a collection that is neither a set nor a list (such as a "bag" or multiset).
    • AbstractSet - Skeletal implementation of a set.
    • AbstractList - Skeletal implementation of a list backed by a random-access data store (such as an array).
    • AbstractSequentialList - Skeletal implementation of a list backed by a sequential-access data store (such as a linked list).
    • AbstractMap - Skeletal implementation of a map.
  • Algorithms

    • java.util.List)"> sort(List) - Sorts a list using a merge sort algorithm, which provides average-case performance comparable to a high-quality quicksort, guaranteed O(n*log n) performance (unlike quicksort), and stability (unlike quicksort). (A stable sort is one that does not reorder equal elements.)
    • binarySearch(List, Object) - Searches for an element in an ordered list using the binary search algorithm.
    • java.util.List)">reverse(List) - Reverses the order of the elements in the a list.
    • java.util.List)">shuffle(List) - Randomly permutes the elements in a list.
    • fill(List, Object) - Overwrites every element in a list with the specified value.
    • java.util.List)">copy List(dest, List src) - Copies the source list into the destination list.
    • java.util.Collection)"> min(Collection) - Returns the minimum element in a collection.
    • java.util.Collection)"> max(Collection) - Returns the maximum element in a collection.
    • rotate List(list, int distance) - Rotates all of the elements in the list by the the specified distance.
    • replaceAll List(list, Object oldVal, Object newVal) - Replaces all occurrences of one specified value with another.
    • java.util.List)">indexOfSubList List(source, List target) - Returns the index of the first sublist of source that is equal to target.
    • java.util.List)">lastIndexOfSubList List(source, List target) - Returns the index of the last sublist of source that is equal to target.
    • swap List(list, int, int) - Swaps the elements at the specified positions in the specified list.
  • Infrastructure

    • Iterators - Similar to the familiar Enumeration interface, but more powerful, and with improved method names.

      • Iterator - In addition to the functionality of the Enumeration interface, allows the user to remove elements from the backing collection with well defined, useful semantics.
      • ListIterator - Iterator for use with lists. In addition to the functionality of the Iterator interface, supports bi-directional iteration, element replacement, element insertion and index retrieval.
    • Ordering

      • Comparable - Imparts a natural ordering to classes that implement it. The natural ordering may be used to sort a list or maintain order in a sorted set or map. Many classes have been retrofitted to implement this interface.
      • Comparator - Represents an order relation, which may be used to sort a list or maintain order in a sorted set or map. Can override a type's natural ordering, or order objects of a type that does not implement the Comparable interface.
    • Runtime Exceptions

      • UnsupportedOperationException - Thrown by collections if an unsupported optional operation is called.
      • ConcurrentModificationException - Thrown by iterators and list iterators if the backing collection is modified unexpectedly while the iteration is in progress. Also thrown by sublist views of lists if the backing list is modified unexpectedly.
    • Performance

      • RandomAccess - Marker interface that allows List implementations to indicate that they support fast (generally constant time) random access. This allows generic algorithms to alter their behavior to provide good performance when applied to either random or sequential access lists.
  • Array Utilities

    • Arrays - Contains static methods to sort, search, compare and fill arrays of primitives and Objects.