Class ItemListBaseImpl<T extends SimpleItem>

  • Type Parameters:
    T - The actual item type
    All Implemented Interfaces:
    ItemListBase<T>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, java.util.RandomAccess
    Direct Known Subclasses:
    ItemListImpl

    public class ItemListBaseImpl<T extends SimpleItem>
    extends java.util.ArrayList<T>
    implements ItemListBase<T>
    Standard implementation of ItemListBase interface based on the ArrayList class.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(TechKey techKey)
      Returns true if this list contains an element with the given technical key

      Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
      boolean contains​(java.lang.String handle)
      Returns true if this list contains an element with the given handle

      Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
      T get​(TechKey techKey)
      Returns the item specified by the given technical key.

      Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
      T get​(java.lang.String handle)
      Returns the item specified by the given handle.

      Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
      int indexOf​(TechKey techKey)
      Returns the index for the item with the given key.

      Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
      int indexOf​(java.lang.String handle)
      Returns the index for the item with the given handle.
      Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
      boolean remove​(TechKey techKey)
      Remove the given element from this list, if it exists.

      Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
      boolean remove​(java.lang.String handle)
      Remove the given element from this list, if it exists.

      Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
      • Methods inherited from class java.util.ArrayList

        add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • 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
    • Constructor Detail

      • ItemListBaseImpl

        public ItemListBaseImpl()
    • Method Detail

      • contains

        public boolean contains​(java.lang.String handle)
        Description copied from interface: ItemListBase
        Returns true if this list contains an element with the given handle

        Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
        Specified by:
        contains in interface ItemListBase<T extends SimpleItem>
        Parameters:
        handle - handle to search for
        Returns:
        true if this list contains an element with the given handle
      • contains

        public boolean contains​(TechKey techKey)
        Description copied from interface: ItemListBase
        Returns true if this list contains an element with the given technical key

        Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
        Specified by:
        contains in interface ItemListBase<T extends SimpleItem>
        Parameters:
        techKey - techKey to search for
        Returns:
        true if this list contains an element with the given technical key
      • get

        public T get​(java.lang.String handle)
        Description copied from interface: ItemListBase
        Returns the item specified by the given handle.

        Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
        Specified by:
        get in interface ItemListBase<T extends SimpleItem>
        Parameters:
        handle - the handle of the item that should be retrieved
        Returns:
        the item with the given handle or null if no item for that key was found.
      • get

        public T get​(TechKey techKey)
        Description copied from interface: ItemListBase
        Returns the item specified by the given technical key.

        Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
        Specified by:
        get in interface ItemListBase<T extends SimpleItem>
        Parameters:
        techKey - the technical key of the item that should be retrieved
        Returns:
        the item with the given techical key or null if no item for that key was found.
      • indexOf

        public int indexOf​(java.lang.String handle)
        Description copied from interface: ItemListBase
        Returns the index for the item with the given handle.
        Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
        Specified by:
        indexOf in interface ItemListBase<T extends SimpleItem>
        Parameters:
        handle - item handle
        Returns:
        index in the item list, or -1 if such an element does not exists.
      • indexOf

        public int indexOf​(TechKey techKey)
        Description copied from interface: ItemListBase
        Returns the index for the item with the given key.

        Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
        Specified by:
        indexOf in interface ItemListBase<T extends SimpleItem>
        Parameters:
        techKey - item key
        Returns:
        index in the item list, or -1 if such an element does not exists.
      • remove

        public boolean remove​(java.lang.String handle)
        Description copied from interface: ItemListBase
        Remove the given element from this list, if it exists.

        Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
        Specified by:
        remove in interface ItemListBase<T extends SimpleItem>
        Parameters:
        handle - of element to remove from the list
        Returns:
        true if this list contained the specified element
      • remove

        public boolean remove​(TechKey techKey)
        Description copied from interface: ItemListBase
        Remove the given element from this list, if it exists.

        Note - This implementation assumes that the list is small and performs a simple search running in the list from the first element to the last.
        Specified by:
        remove in interface ItemListBase<T extends SimpleItem>
        Parameters:
        techKey - index of element to remove from the list
        Returns:
        true if this list contained the specified element