E
- the type of content of this Collectionpublic interface ImmutableCollection<E> extends Iterable<E>, Serializable
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Object o)
Returns true if this immutable collection contains the specified element.
|
boolean |
containsAll(Collection<?> c)
Returns true if this immutable collection contains all of the elements in the specified collection.
|
boolean |
containsAll(ImmutableCollection<?> c)
Returns true if this immutable collection contains all of the elements in the specified immutable collection.
|
boolean |
equals(Object obj)
Force to redefine equals for the implementations of immutable collection classes.
|
int |
hashCode()
Force to redefine hashCode for the implementations of immutable collection classes.
|
default boolean |
isCopy()
Return whether the internal storage is a (shallow) copy of the original collection.
|
boolean |
isEmpty()
Returns true if this immutable collection contains no elements.
|
boolean |
isWrap()
Return whether the internal storage is a wrapped pointer to the original collection.
|
ImmutableIterator<E> |
iterator()
Returns an immutable iterator over the elements in this immutable collection.
|
default Stream<E> |
parallelStream()
Returns a possibly parallel
Stream with this collection as its source. |
int |
size()
Returns the number of elements in this immutable collection.
|
default Spliterator<E> |
spliterator()
Creates a Spliterator over the elements in this collection.
|
default Stream<E> |
stream()
Returns a sequential
Stream with this collection as its source. |
Object[] |
toArray()
Returns an array containing all of the elements in this immutable collection.
|
<T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this immutable collection; the runtime type of the returned array is
that of the specified array.
|
Collection<E> |
toCollection()
Returns a modifiable copy of this immutable collection.
|
int size()
boolean isEmpty()
boolean contains(Object o)
o
- element whose presence in this immutable collection is to be testedClassCastException
- if the type of the specified element is incompatible with this immutable collectionNullPointerException
- if the specified element is null and this immutable collection does not permit null elementsImmutableIterator<E> iterator()
Object[] toArray()
See java.util.Collection.toArray() for more details.
<T> T[] toArray(T[] a)
See java.util.Collection.toArray(T[]) for more details.
T
- the runtime type of the array to contain the immutable collectiona
- the array into which the elements of this immutable collection are to be stored, if it is big enough; otherwise,
a new array of the same runtime type is allocated for this purpose.ArrayStoreException
- if the runtime type of the specified array is not a supertype of the runtime type of every
element in this immutable collectionNullPointerException
- if the specified array is nullboolean containsAll(Collection<?> c)
c
- collection to be checked for containment in this immutable collectionClassCastException
- if the types of one or more elements in the specified collection are incompatible with this
immutable collectionNullPointerException
- if the specified collection contains one or more null elements and this immutable collection
does not permit null elements, or if the specified collection is null.contains(Object)
boolean containsAll(ImmutableCollection<?> c)
c
- immutable collection to be checked for containment in this immutable collectionClassCastException
- if the types of one or more elements in the specified immutable collection are incompatible
with this immutable collectionNullPointerException
- if the specified immutable collection contains one or more null elements and this immutable
collection does not permit null elements, or if the specified immutable collection is null.contains(Object)
default Spliterator<E> spliterator()
spliterator
in interface Iterable<E>
Spliterator
over the elements in this collectiondefault Stream<E> stream()
Stream
with this collection as its source.
This method should be overridden when the spliterator()
method cannot return a spliterator that is
IMMUTABLE
, CONCURRENT
, or late-binding. (See spliterator()
for details.)
Stream
over the elements in this collectiondefault Stream<E> parallelStream()
Stream
with this collection as its source. It is allowable for this method to return
a sequential stream.
This method should be overridden when the spliterator()
method cannot return a spliterator that is
IMMUTABLE
, CONCURRENT
, or late-binding. (See spliterator()
for details.)
Stream
over the elements in this collectionCollection<E> toCollection()
boolean equals(Object obj)
int hashCode()
boolean isWrap()
default boolean isCopy()
Copyright © 2014–2016 Delft University of Technology. All rights reserved.