Package org.djutils.immutablecollections
Class ImmutableAbstractCollection<E>
java.lang.Object
org.djutils.immutablecollections.ImmutableAbstractCollection<E>
- Type Parameters:
E
- the type of content of this Set
- All Implemented Interfaces:
Serializable
,Iterable<E>
,ImmutableCollection<E>
- Direct Known Subclasses:
ImmutableAbstractList
,ImmutableAbstractSet
public abstract class ImmutableAbstractCollection<E>
extends Object
implements ImmutableCollection<E>
An abstract base class for an immutable wrapper for a Set.
Copyright (c) 2016-2024 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
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Immutable
COPY stores a safe, internal copy of the collection; WRAP stores a pointer to the original collection. -
Constructor Summary
ConstructorDescriptionImmutableAbstractCollection
(Immutable copyOrWrap) Construct an abstract immutable collection. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Collection<E>
Returns the underlying collection of this immutable collection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.djutils.immutablecollections.ImmutableCollection
contains, containsAll, containsAll, equals, hashCode, isCopy, isEmpty, isWrap, iterator, parallelStream, size, spliterator, stream, toArray, toArray, toCollection
-
Field Details
-
copyOrWrap
COPY stores a safe, internal copy of the collection; WRAP stores a pointer to the original collection.
-
-
Constructor Details
-
ImmutableAbstractCollection
Construct an abstract immutable collection.- Parameters:
copyOrWrap
- Immutable; indicates whether the immutable is a copy or a wrap
-
-
Method Details
-
getUnderlyingCollection
Returns 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.- Returns:
- the underlying collection of this immutable collection.
-