Class HashMap

  • All Implemented Interfaces:
    Map, Serializable, Serializable
    Direct Known Subclasses:
    DataStore

    public class HashMap
    extends Object
    implements Map, Serializable
    The LEAP (environment-dependent) version of the &qote;java.util.HashMap&qote; class. This class appears to be exactly the same in J2SE, PJAVA and MIDP. The internal implementation is different in the three cases however.
    Version:
    1.0, 29/09/00
    Author:
    Nicolas Lhuillier
    See Also:
    HashMap, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      HashMap()
      Default constructor, creates a new empty Map
      HashMap​(int s)
      Constructor, creates a new Map with initial size
      HashMap​(int s, float lf)
      Constructor, creates a new Map with initial size and load factor
    • Constructor Detail

      • HashMap

        public HashMap()
        Default constructor, creates a new empty Map
      • HashMap

        public HashMap​(int s)
        Constructor, creates a new Map with initial size
      • HashMap

        public HashMap​(int s,
                       float lf)
        Constructor, creates a new Map with initial size and load factor
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Map
        Returns true if this map contains no key-value mappings.
        Specified by:
        isEmpty in interface Map
        Returns:
        true if this map contains no key-value mappings.
        See Also:
        interface
      • remove

        public Object remove​(Object o)
        Description copied from interface: Map
        Removes the mapping for this key from this map if present (optional operation).
        Specified by:
        remove in interface Map
        Parameters:
        o - key whose mapping is to be removed from the map.
        Returns:
        previous value associated with specified key, or null if there was no mapping for key.
        See Also:
        interface
      • put

        public Object put​(Object key,
                          Object value)
        Description copied from interface: Map
        Associates the specified value with the specified key in this map (optional operation).
        Specified by:
        put in interface Map
        Parameters:
        key - key with which the specified value is to be associated.
        value - value to be associated with the specified key.
        Returns:
        previous value associated with specified key, or null if there was no mapping for key.
        See Also:
        interface
      • get

        public Object get​(Object key)
        Description copied from interface: Map
        Returns the value to which this map maps the specified key. Returns null if the map contains no mapping for this key.
        Specified by:
        get in interface Map
        Parameters:
        key - key whose associated value is to be returned.
        Returns:
        the value to which this map maps the specified key, or null if the map contains no mapping for this key.
        See Also:
        interface
      • size

        public int size()
        Description copied from interface: Map
        Returns the number of mappings in this map.
        Specified by:
        size in interface Map
        See Also:
        interface
      • containsKey

        public boolean containsKey​(Object key)
        Description copied from interface: Map
        Returns true if this map contains a mapping for the specified key.
        Specified by:
        containsKey in interface Map
        Parameters:
        key - key whose presence in this map is to be tested.
        Returns:
        true if this map contains a mapping for the specified key.
        See Also:
        interface
      • clear

        public void clear()
        Description copied from interface: Map
        Remove all mappings from this map.
        Specified by:
        clear in interface Map
        See Also:
        interface
      • keySet

        public Set keySet()
        Description copied from interface: Map
        Returns a set view of the keys contained in this map.
        Specified by:
        keySet in interface Map
        Returns:
        a set view of the keys contained in this map.
        See Also:
        interface
      • values

        public Collection values()
        Description copied from interface: Map
        Returns a Collection view of the values contained in this map.
        Specified by:
        values in interface Map
        Returns:
        the Collection of elements contained in this map.
        See Also:
        interface