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 TypeMethodDescriptionvoidaddTypedObject(Object object) Adds an object to the collection.getType()Retrieves the class type of the objects that this collection holds.
-
Method Details
-
getType
Retrieves the class type of the objects that this collection holds.- Returns:
- The class type of the objects in this collection.
-
addTypedObject
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.
-