Class ImmutableOpenMap<KType,​VType>

    • Method Detail

      • get

        public VType get​(KType key)
        Returns:
        Returns the value associated with the given key or the default value for the key type, if the key is not associated with any value.

        Important note: For primitive type values, the value returned for a non-existing key may not be the default value of the primitive type (it may be any value previously assigned to that slot).

      • getOrDefault

        public VType getOrDefault​(KType key,
                                  VType defaultValue)
        Returns:
        Returns the value associated with the given key or the provided default value if the key is not associated with any value.
      • containsKey

        public boolean containsKey​(KType key)
        Returns true if this container has an association to a value for the given key.
      • size

        public int size()
        Returns:
        Returns the current size (number of assigned keys) in the container.
      • isEmpty

        public boolean isEmpty()
        Returns:
        Return true if this hash map contains no assigned keys.
      • iterator

        public Iterator<ObjectObjectCursor<KType,​VType>> iterator()
        Returns a cursor over the entries (key-value pairs) in this map. The iterator is implemented as a cursor and it returns the same cursor instance on every call to Iterator.next(). To read the current key and value use the cursor's public fields. An example is shown below.
         for (IntShortCursor c : intShortMap)
         {
             System.out.println("index=" + c.index
               + " key=" + c.key
               + " value=" + c.value);
         }
         

        The index field inside the cursor gives the internal index inside the container's implementation. The interpretation of this index depends on to the container.

        Specified by:
        iterator in interface Iterable<KType>
      • keysIt

        public Iterator<KType> keysIt()
        Returns a direct iterator over the keys.
      • values

        public ObjectContainer<VType> values()
        Returns:
        Returns a container with all values stored in this map.
      • valuesIt

        public Iterator<VType> valuesIt()
        Returns a direct iterator over the keys.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • copyOf

        public static <KType,​VType> ImmutableOpenMap<KType,​VType> copyOf​(ObjectObjectMap<KType,​VType> map)
        Returns:
        An immutable copy of the given map