Interface TypedCollection<E>

Type Parameters:
E - The type of objects that this collection holds.
All Known Implementing Classes:
TypedArrayList, TypedHashSet

public interface TypedCollection<E>
A generic interface representing a collection that enforces a specific type for its elements.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds an object to the collection.
    Retrieves the class type of the objects that this collection holds.
  • Method Details

    • getType

      Class<E> getType()
      Retrieves the class type of the objects that this collection holds.
      Returns:
      The class type of the objects in this collection.
    • addTypedObject

      void addTypedObject(Object object)
      Adds an object to the collection. The object must match the type of the collection.
      Parameters:
      object - The object to add to the collection.
      Throws:
      IllegalArgumentException - if the object is not of the correct type.