Class EnumeratedMap

  • All Implemented Interfaces:
    java.util.Map

    public abstract class EnumeratedMap
    extends java.lang.Object
    implements java.util.Map

    This is a Map implementation driven by a data source that only provides an enumeration of keys and a getValue(key) method. This class must be subclassed to implement those methods.

    Some of the methods may incur a performance penalty that involves enumerating the entire data source. In these cases, the Map will try to save the results of that enumeration, but only if the underlying data source is immutable.

    Version:
    $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $
    Author:
    Nathan Abramson - Art Technology Group
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      EnumeratedMap()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean containsKey​(java.lang.Object pKey)  
      boolean containsValue​(java.lang.Object pValue)  
      java.util.Set entrySet()  
      abstract java.util.Enumeration enumerateKeys()
      Returns an enumeration of the keys
      java.lang.Object get​(java.lang.Object pKey)  
      java.util.Map getAsMap()
      Converts the MapSource to a Map.
      abstract java.lang.Object getValue​(java.lang.Object pKey)
      Returns the value associated with the given key, or null if not found.
      boolean isEmpty()  
      abstract boolean isMutable()
      Returns true if it is possible for this data source to change
      java.util.Set keySet()  
      java.lang.Object put​(java.lang.Object pKey, java.lang.Object pValue)  
      void putAll​(java.util.Map pMap)  
      java.lang.Object remove​(java.lang.Object pKey)  
      int size()  
      java.util.Collection values()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Constructor Detail

      • EnumeratedMap

        public EnumeratedMap()
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map
      • containsKey

        public boolean containsKey​(java.lang.Object pKey)
        Specified by:
        containsKey in interface java.util.Map
      • containsValue

        public boolean containsValue​(java.lang.Object pValue)
        Specified by:
        containsValue in interface java.util.Map
      • entrySet

        public java.util.Set entrySet()
        Specified by:
        entrySet in interface java.util.Map
      • get

        public java.lang.Object get​(java.lang.Object pKey)
        Specified by:
        get in interface java.util.Map
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map
      • keySet

        public java.util.Set keySet()
        Specified by:
        keySet in interface java.util.Map
      • put

        public java.lang.Object put​(java.lang.Object pKey,
                                    java.lang.Object pValue)
        Specified by:
        put in interface java.util.Map
      • putAll

        public void putAll​(java.util.Map pMap)
        Specified by:
        putAll in interface java.util.Map
      • remove

        public java.lang.Object remove​(java.lang.Object pKey)
        Specified by:
        remove in interface java.util.Map
      • size

        public int size()
        Specified by:
        size in interface java.util.Map
      • values

        public java.util.Collection values()
        Specified by:
        values in interface java.util.Map
      • enumerateKeys

        public abstract java.util.Enumeration enumerateKeys()
        Returns an enumeration of the keys
      • isMutable

        public abstract boolean isMutable()
        Returns true if it is possible for this data source to change
      • getValue

        public abstract java.lang.Object getValue​(java.lang.Object pKey)
        Returns the value associated with the given key, or null if not found.
      • getAsMap

        public java.util.Map getAsMap()
        Converts the MapSource to a Map. If the map is not mutable, this is cached