Interface ShortObjectMap<V>

All Superinterfaces:
InternalIterable<V>, Iterable<V>, PrimitiveObjectMap<V>, RichIterable<V>
All Known Subinterfaces:
ImmutableShortObjectMap<V>, MutableShortObjectMap<V>
All Known Implementing Classes:
AbstractImmutableShortObjectMap, ShortObjectHashMap, SynchronizedShortObjectMap, UnmodifiableShortObjectMap

public interface ShortObjectMap<V>
extends PrimitiveObjectMap<V>
This file was automatically generated from template file primitiveObjectMap.stg.
Since:
3.0.
  • Method Details

    • get

      V get​(short key)
      Retrieves the value associated with the key. If no mapping exists for the key, null is returned.
      Parameters:
      key - the key
      Returns:
      the value associated with the key, or the default value if no such mapping exists
    • getIfAbsent

      V getIfAbsent​(short key, Function0<? extends V> ifAbsent)
      Retrieves the value associated with the key if one exists; if it does not, returns the result of invoking the value supplier.
      Parameters:
      key - the key
      function - the supplier that provides the value if no mapping exists for key
      Returns:
      the value associated with the key, if one exists, or the result of invoking ifAbsent if not
    • containsKey

      boolean containsKey​(short key)
      Returns whether or not the key is present in the map.
      Parameters:
      key - the key
      Returns:
      if a mapping exists in this map for the key
    • tap

      ShortObjectMap<V> tap​(Procedure<? super V> procedure)
      Description copied from interface: RichIterable
      Executes the Procedure for each element in the iterable and returns this.

      Example using a Java 8 lambda expression:

       RichIterable<Person> tapped =
           people.tap(person -> LOGGER.info(person.getName()));
       

      Example using an anonymous inner class:

       RichIterable<Person> tapped =
           people.tap(new Procedure<Person>()
           {
               public void value(Person person)
               {
                   LOGGER.info(person.getName());
               }
           });
       
      Specified by:
      tap in interface RichIterable<V>
      See Also:
      RichIterable.each(Procedure), RichIterable.forEach(Procedure)
    • forEachKey

      void forEachKey​(ShortProcedure procedure)
      Iterates through each key in the map, invoking the procedure for each.
      Parameters:
      procedure - the procedure to invoke for each key
    • forEachKeyValue

      void forEachKeyValue​(ShortObjectProcedure<? super V> procedure)
      Iterates through each key/value pair in the map, invoking the procedure for each.
      Parameters:
      procedure - the procedure to invoke for each key/value pair
    • select

      ShortObjectMap<V> select​(ShortObjectPredicate<? super V> predicate)
      Return a copy of this map containing only the key/value pairs that match the predicate.
      Parameters:
      predicate - the predicate to determine which key/value pairs in this map should be included in the returned map
      Returns:
      a copy of this map with the matching key/value pairs
    • reject

      ShortObjectMap<V> reject​(ShortObjectPredicate<? super V> predicate)
      Return a copy of this map containing only the key/value pairs that do not match the predicate.
      Parameters:
      predicate - the predicate to determine which key/value pairs in this map should be excluded from the returned map
      Returns:
      a copy of this map without the matching key/value pairs
    • toImmutable

      ImmutableShortObjectMap<V> toImmutable()
      Returns a copy of this map that is immutable (if this map is mutable) or itself if it is already immutable.
      Returns:
      an immutable map that is equivalent to this one
    • keySet

      MutableShortSet keySet()
      Returns a set containing all the keys in this map. The set is backed by the map, so any modifications to the returned set will affect this map.
      Returns:
      a mutable set containing the keys in this map
    • keysView

      LazyShortIterable keysView()
      Returns a view of the keys in this map. This iterable is backed by the map, so any modifications to the underlying map will be reflected in the keys returned by the iterable.
      Returns:
      a view of the keys in this map
      Since:
      5.0
    • keyValuesView

      RichIterable<ShortObjectPair<V>> keyValuesView()
      Returns a view of the key/value pairs in this map. This iterable is backed by the map, so any modifications to the underlying map will be reflected in the pairs returned by the iterable.
      Returns:
      a view of the keys in this map
      Since:
      5.0
    • flipUniqueValues

      ObjectShortMap<V> flipUniqueValues()
      Return the ObjectShortMap that is obtained by flipping the direction of this map and making the associations from value to key.
      Throws:
      IllegalStateException - if the ObjectShortMap contains duplicate values.
      Since:
      9.0