Class TypedArrayList<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
enterprises.iwakura.sigewine.utils.collections.TypedArrayList<E>
Type Parameters:
E - The type of elements in this list.
All Implemented Interfaces:
TypedCollection<E>, Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess, SequencedCollection<E>

public class TypedArrayList<E> extends ArrayList<E> implements TypedCollection<E>
A concrete implementation of TypedCollection that uses an ArrayList as the underlying data structure.
See Also:
  • Constructor Details

    • TypedArrayList

      public TypedArrayList(Class<E> type)
      Constructor that initializes the list with the specified type.
      Parameters:
      type - The class type of the elements in this list.
  • Method Details

    • addTypedObject

      public void addTypedObject(Object object)
      Adds an object to the array, ensuring it matches the specified type.
      Specified by:
      addTypedObject in interface TypedCollection<E>
      Parameters:
      object - The object to add to the array.
      Throws:
      IllegalArgumentException - if the object is not of the correct type.