Class TypedHashSet<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
java.util.HashSet<E>
enterprises.iwakura.sigewine.utils.collections.TypedHashSet<E>
Type Parameters:
E - The type of elements in this set
All Implemented Interfaces:
TypedCollection<E>, Serializable, Cloneable, Iterable<E>, Collection<E>, Set<E>

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

    • TypedHashSet

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

    • addTypedObject

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