Package com.telenordigital.nbiot
Class ImmutableCollectionList
- java.lang.Object
-
- com.telenordigital.nbiot.ImmutableCollectionList
-
- All Implemented Interfaces:
Collection.CollectionList
@ParametersAreNonnullByDefault @Immutable public final class ImmutableCollectionList extends Object implements Collection.CollectionList
Immutable implementation ofCollection.CollectionList.Use the builder to create immutable instances:
new ImmutableCollectionList.Builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableCollectionList.BuilderBuilds instances of typeImmutableCollectionList.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection[]collections()static ImmutableCollectionListcopyOf(Collection.CollectionList instance)Creates an immutable copy of aCollection.CollectionListvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableCollectionListthat have equal attribute values.inthashCode()Computes a hash code from attributes:collections.StringtoString()Prints the immutable valueCollectionListwith attribute values.ImmutableCollectionListwithCollections(Collection... elements)Copy the current immutable object with elements that replace the content ofcollections.
-
-
-
Method Detail
-
collections
@Nullable public Collection[] collections()
- Specified by:
collectionsin interfaceCollection.CollectionList- Returns:
- A cloned
collectionsarray
-
withCollections
public final ImmutableCollectionList withCollections(@Nullable Collection... elements)
Copy the current immutable object with elements that replace the content ofcollections. The array is cloned before being saved as attribute values.- Parameters:
elements- The non-null elements for collections- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableCollectionListthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:collections.
-
toString
public String toString()
Prints the immutable valueCollectionListwith attribute values.
-
copyOf
public static ImmutableCollectionList copyOf(Collection.CollectionList instance)
Creates an immutable copy of aCollection.CollectionListvalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable CollectionList instance
-
-