Class SortedArrayMap<Key extends Comparable<Key>,Value>

java.lang.Object
dsa.lab05.exercises.SortedArrayMap<Key,Value>
Type Parameters:
Key - the key type
Value - the value type
All Implemented Interfaces:
Container<MapItem<Key,Value>>, Map<Key,Value>, OrderedMap<Key,Value>, Iterable<MapItem<Key,Value>>

public class SortedArrayMap<Key extends Comparable<Key>,Value> extends Object implements OrderedMap<Key,Value>
A sorted array map.
  • Constructor Details

    • SortedArrayMap

      public SortedArrayMap()
      Construct an empty sorted array map.
    • SortedArrayMap

      public SortedArrayMap(Iterable<MapItem<Key,Value>> items)
      Construct a sorted array map containing the given items.
      Parameters:
      items - the items
    • SortedArrayMap

      public SortedArrayMap(Iterable<MapItem<Key,Value>> items, int size) throws IllegalArgumentException
      Construct a sorted array map containing the given items more efficiently than SortedArrayMap(Iterable).
      Parameters:
      items - the items
      size - the number of items
      Throws:
      IllegalArgumentException - if size != n (where n is items's size)
    • SortedArrayMap

      @SafeVarargs public SortedArrayMap(MapItem<Key,Value>... items)
      Construct a sorted array map containing the given items.
      Parameters:
      items - the items
  • Method Details