Class OrderedMap

  • All Implemented Interfaces:
    Map

    public class OrderedMap
    extends Object
    implements Map
    A Map that preserves the order of its keys.
    • Constructor Detail

      • OrderedMap

        public OrderedMap​(List keyList,
                          Map map)
        Creates an OrderedMap backed by the given map.
        Parameters:
        map - a Map that will be this OrderedMap's underlying Map
      • OrderedMap

        public OrderedMap()
        Creates an OrderedMap.
      • OrderedMap

        public OrderedMap​(Map map)
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface Map
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Map
      • containsKey

        public boolean containsKey​(Object key)
        Specified by:
        containsKey in interface Map
      • containsValue

        public boolean containsValue​(Object value)
        Specified by:
        containsValue in interface Map
      • putAll

        public void putAll​(Map t)
        Specified by:
        putAll in interface Map
      • clear

        public void clear()
        Specified by:
        clear in interface Map
      • keySet

        public Set keySet()
        Specified by:
        keySet in interface Map
      • keyList

        public List keyList()
        Returns the keys, in order.
        Returns:
        the keys in the order they were (first) added
      • valueList

        public List valueList()
        Returns the values.
        Returns:
        the values in the same order as the keys
        See Also:
        keyList()
      • values

        public Collection values()
        Returns the values.
        Specified by:
        values in interface Map
        Returns:
        the values in the same order as the keys
        See Also:
        keyList()
      • entrySet

        public Set entrySet()
        Specified by:
        entrySet in interface Map