Interface MappedList<K,​E>

  • All Superinterfaces:
    java.util.Collection<E>, java.lang.Iterable<E>, java.util.List<E>
    All Known Implementing Classes:
    DecoratorIDedMappedList

    public interface MappedList<K,​E>
    extends java.util.List<E>
    A list that allows quick lookup of its elements. This interface does not implement Map, because the Map interface has remove(Object) semantics that conflict with those of the corresponding List method.
    Author:
    Garret Wilson
    See Also:
    List, Map
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.Object key)
      Returns true if this map contains a mapping for the specified key.
      E get​(java.lang.Object key)
      Returns the value to which this map maps the specified key.
      E removeKey​(java.lang.Object key)
      Removes the value from the list mapped to the given key value.
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
    • Method Detail

      • containsKey

        boolean containsKey​(java.lang.Object key)
        Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)
        Parameters:
        key - key whose presence in this map is to be tested.
        Returns:
        true if this map contains a mapping for the specified key.
        Throws:
        java.lang.ClassCastException - if the key is of an inappropriate type for this map (optional).
        java.lang.NullPointerException - if the key is null and this map does not permit null keys (optional).
      • get

        E get​(java.lang.Object key)
        Returns the value to which this map maps the specified key. Returns null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

        More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

        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.
        Throws:
        java.lang.ClassCastException - if the key is of an inappropriate type for this map (optional).
        java.lang.NullPointerException - if the key is null and this map does not permit null keys (optional).
        See Also:
        containsKey(Object)
      • removeKey

        E removeKey​(java.lang.Object key)
        Removes the value from the list mapped to the given key value.
        Parameters:
        key - The key whose mapping is to be removed from the map and whose corresponding value is to be removed from the list.
        Returns:
        previous value associated with specified key, or null if there was no mapping for key.
        Throws:
        java.lang.ClassCastException - if the key is of an inappropriate type for this mapped list (optional).
        java.lang.NullPointerException - if the key is null and this mapped list does not permit null keys (optional).
        java.lang.UnsupportedOperationException - if the remove method is not supported by this mapped list.