Class ArrayNamedListImpl<T>

All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, List<T>, RandomAccess, SequencedCollection<T>, NamedList<T>
Direct Known Subclasses:
NamedListImpl

public abstract class ArrayNamedListImpl<T> extends ArrayList<T> implements NamedList<T>
Implementation of NamedList which uses ArrayList for storage.

Derived class must implement NamedList.getName(Object), to indicate how elements are named.

Since:
Nov 12, 2007
Author:
jhyde
See Also:
  • Constructor Details

    • ArrayNamedListImpl

      public ArrayNamedListImpl(int initialCapacity)
      Creates an empty list with the specified initial capacity.
      Parameters:
      initialCapacity - the initial capacity of the list
      Throws:
      IllegalArgumentException - if the specified initial capacity is negative
    • ArrayNamedListImpl

      public ArrayNamedListImpl()
      Creates an empty list.
    • ArrayNamedListImpl

      public ArrayNamedListImpl(Collection<? extends T> c)
      Creates a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.
      Parameters:
      c - the collection whose elements are to be placed into this list
      Throws:
      NullPointerException - if the specified collection is null
  • Method Details

    • get

      public T get(String name)
      Description copied from interface: NamedList
      Retrieves a member by name.
      Specified by:
      get in interface NamedList<T>
      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:
    • indexOfName

      public int indexOfName(String name)
      Description copied from interface: NamedList
      Returns the position where a member of a given name is found, or -1 if the member is not present.
      Specified by:
      indexOfName in interface NamedList<T>
      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:
    • asMap

      public Map<String,T> asMap()
      Description copied from interface: NamedList
      Returns a view of this named list as a Map whose key is the name of each element.
      Specified by:
      asMap in interface NamedList<T>
      Returns:
      A view of this named list as a map