Interface NamedList<E>

  • All Superinterfaces:
    java.util.Collection<E>, java.lang.Iterable<E>, java.util.List<E>

    public interface NamedList<E>
    extends java.util.List<E>
    Extension to List which allows access to members of the list by name as well as by ordinal.
    Since:
    Aug 22, 2006
    Author:
    jhyde
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​E> asMap()
      Returns a view of this named list as a Map whose key is the name of each element.
      E get​(java.lang.String name)
      Retrieves a member by name.
      java.lang.String getName​(java.lang.Object element)
      Returns the name of a given element.
      int indexOfName​(java.lang.String name)
      Returns the position where a member of a given name is found, or -1 if the member is not present.
      • 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

      • get

        E get​(java.lang.String name)
        Retrieves a member by name.
        Parameters:
        name - name of the element to return
        Returns:
        the element of the list with the specified name, or null if there is no such element
        See Also:
        List.get(int)
      • indexOfName

        int indexOfName​(java.lang.String name)
        Returns the position where a member of a given name is found, or -1 if the member is not present.
        Parameters:
        name - name of the element to return
        Returns:
        the index of element of the list with the specified name, or -1 if there is no such element
        See Also:
        List.indexOf(Object)
      • getName

        java.lang.String getName​(java.lang.Object element)
        Returns the name of a given element.
        Parameters:
        element - Element
        Returns:
        Name of element
      • asMap

        java.util.Map<java.lang.String,​E> asMap()
        Returns a view of this named list as a Map whose key is the name of each element.
        Returns:
        A view of this named list as a map