Collections


  • Common collection activities include adding objects, removing objects, verifying object inclusion, retrieving objects, and iterating.
  • Three meanings for "collection":
  • collection Represents the data structure in which objects are stored
  • Collection java.util interface from which Set and List extend
  • Collections A class that holds static collection utility methods
  • Four basic flavors of collections include Lists, Sets, Maps, Queues:
  • Lists of things Ordered, duplicates allowed, with an index.
  • Sets of things May or may not be ordered and/or sorted; duplicates not allowed.
  • Maps of things with keys May or may not be ordered and/or sorted; duplicate keys are not allowed.
  • Queues of things to process Ordered by FIFO or by priority.
  • Four basic sub-flavors of collections Sorted, Unsorted, Ordered, Unordered.
  • Ordered Iterating through a collection in a specific, non-random order.
  • Sorted Iterating through a collection in a sorted order.
  • Sorting can be alphabetic, numeric, or programmer-defined.