Package org.djutils.immutablecollections
Class ImmutableHashSet<E>
java.lang.Object
org.djutils.immutablecollections.ImmutableAbstractCollection<E>
org.djutils.immutablecollections.ImmutableAbstractSet<E>
org.djutils.immutablecollections.ImmutableHashSet<E>
- Type Parameters:
- E- the type of content of this Set
- All Implemented Interfaces:
- Iterable<E>,- ImmutableCollection<E>,- ImmutableSet<E>
An immutable wrapper for a HashSet.
 
Copyright (c) 2016-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
- Alexander Verbraeck, Peter Knoppers
- 
Field SummaryFields inherited from class org.djutils.immutablecollections.ImmutableAbstractCollectioncopyOrWrap
- 
Constructor SummaryConstructorsConstructorDescriptionImmutableHashSet(Collection<? extends E> collection) Construct a new ImmutableHashSet containing a copy of the provided collection.ImmutableHashSet(Set<E> set, Immutable copyOrWrap) Construct a new ImmutableHashSet containing the provided set.ImmutableHashSet(ImmutableAbstractCollection<? extends E> collection) Construct a new ImmutableHashSet containing a copy of the provided Collection.ImmutableHashSet(ImmutableAbstractSet<E> set, Immutable copyOrWrap) Construct a new ImmutableHashSet containing the provided set.
- 
Method SummaryMethods inherited from class org.djutils.immutablecollections.ImmutableAbstractSetcontains, containsAll, containsAll, equals, forEach, hashCode, isEmpty, isWrap, iterator, parallelStream, size, spliterator, stream, toArray, toArray, toCollectionMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.immutablecollections.ImmutableCollectionisCopy
- 
Constructor Details- 
ImmutableHashSetConstruct a new ImmutableHashSet containing a copy of the provided collection.- Parameters:
- collection- the collection to use for the immutable set.
 
- 
ImmutableHashSetConstruct a new ImmutableHashSet containing the provided set.- Parameters:
- set- the set to use for the immutable set.
- copyOrWrap- WRAP stores a pointer to the original collection
 
- 
ImmutableHashSetConstruct a new ImmutableHashSet containing a copy of the provided Collection.- Parameters:
- collection- the collection to use for the immutable set.
 
- 
ImmutableHashSetConstruct a new ImmutableHashSet containing the provided set.- Parameters:
- set- the set to use for the immutable set.
- copyOrWrap- WRAP stores a pointer to the original collection
 
 
- 
- 
Method Details- 
getUnderlyingCollectionDescription copied from class:ImmutableAbstractCollectionReturns the underlying collection of this immutable collection. In case of Immutable.WRAP, this will be the original collection. In case of IMMUTABLE.COPY, this will be the internally stored (mutable) copy of the collection.- Overrides:
- getUnderlyingCollectionin class- ImmutableAbstractSet<E>
- Returns:
- the underlying collection of this immutable collection.
 
- 
toSetDescription copied from interface:ImmutableSetReturns a modifiable copy of this immutable set.- Returns:
- a modifiable copy of this immutable set.
 
- 
toStringDescription copied from interface:ImmutableSetForce to redefine toString.- Specified by:
- toStringin interface- ImmutableSet<E>
- Overrides:
- toStringin class- Object
- Returns:
- a description of this immutable set
 
 
-