Package org.djutils.immutablecollections
Enum Immutable
- java.lang.Object
-
- java.lang.Enum<Immutable>
-
- org.djutils.immutablecollections.Immutable
-
- All Implemented Interfaces:
Serializable
,Comparable<Immutable>
public enum Immutable extends Enum<Immutable>
Indicate whether the immutable collection contains a COPY of the collection (neither changeable by the user of the immutable collection, nor by anyone holding a pointer to the original collection), or a WRAP for the original collection (not changeable by the user of the immutable collection, but can be changed by anyone holding a pointer to the original collection that is wrapped).Copyright (c) 2016-2021 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
-
-
Enum Constant Summary
Enum Constants Enum Constant Description COPY
A copy is neither changeable by the user of the immutable collection, nor by anyone holding a pointer to the original collection that is put into the immutable collection.WRAP
A wrapped immutable collection is not changeable by the user of the immutable collection, but can be changed by anyone holding a pointer to the original collection that is wrapped.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isCopy()
boolean
isWrap()
static Immutable
valueOf(String name)
Returns the enum constant of this type with the specified name.static Immutable[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
COPY
public static final Immutable COPY
A copy is neither changeable by the user of the immutable collection, nor by anyone holding a pointer to the original collection that is put into the immutable collection.
-
WRAP
public static final Immutable WRAP
A wrapped immutable collection is not changeable by the user of the immutable collection, but can be changed by anyone holding a pointer to the original collection that is wrapped.
-
-
Method Detail
-
values
public static Immutable[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Immutable c : Immutable.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Immutable valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
isCopy
public boolean isCopy()
- Returns:
- whether the immutable is a COPY
-
isWrap
public boolean isWrap()
- Returns:
- whether the immutable is a WRAP
-
-