Class ImmutableStrictList<E>
java.lang.Object
com.polarion.alm.shared.api.utils.collections.ImmutableStrictList<E>
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable,IterableWithSize<E>,ReadOnlyStrictCollection<E>,ReadOnlyStrictList<E>,Serializable,Iterable<E>
- Since:
- 3.9.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionImmutableStrictList(E... elements) ImmutableStrictList(Iterable<? extends E> elements) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAllTo(Collection<? super E> collection) asList()Returns the adapter toListinterface for use with 3rd party code or standard Java libraries.booleanbooleancontainsAll(Iterable<? extends E> elements) booleanget(int index) getLast()inthashCode()intintindexOfInstance(E instance, int lastKnownIndex) Searches the given instance using the == operator instead of equals().booleanisEmpty()iterator()intsize()E[]Iterating over array is faster, when checking for concurrent modification is not needed.Returns new ArrayList containing the same elements, so modifying the returned list does not modify the original collection.toString()<T> ImmutableStrictList<T>toTransformed(NotStrictTransformer<E, T> transformer) Each element from the collection will be transformed or skipped (if transformer returnsnull)<T> ImmutableStrictList<T>toTransformed(StrictTransformer<E, T> transformer) Each element from the collection will be transformed.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ImmutableStrictList
-
ImmutableStrictList
-
-
Method Details
-
addAllTo
- Specified by:
addAllToin interfaceIterableWithSize<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceIterableWithSize<E>
-
size
public int size()- Specified by:
sizein interfaceIterableWithSize<E>
-
contains
- Specified by:
containsin interfaceReadOnlyStrictCollection<E>
-
containsAll
- Specified by:
containsAllin interfaceReadOnlyStrictCollection<E>
-
indexOf
- Specified by:
indexOfin interfaceReadOnlyStrictList<E>- Returns:
- -1 if the element is not in the collection
-
indexOfInstance
Description copied from interface:ReadOnlyStrictListSearches the given instance using the == operator instead of equals().- Specified by:
indexOfInstancein interfaceReadOnlyStrictList<E>lastKnownIndex- - last known index for optimized search, use -1 if not know- Returns:
- -1 if the element is not in the collection
-
get
- Specified by:
getin interfaceReadOnlyStrictList<E>
-
getLast
- Specified by:
getLastin interfaceReadOnlyStrictList<E>
-
iterator
-
toString
-
toArrayList
Description copied from interface:IterableWithSizeReturns new ArrayList containing the same elements, so modifying the returned list does not modify the original collection.- Specified by:
toArrayListin interfaceIterableWithSize<E>
-
toArray
Description copied from interface:IterableWithSizeIterating over array is faster, when checking for concurrent modification is not needed.- Specified by:
toArrayin interfaceIterableWithSize<E>- Parameters:
a- - must have exactly the same size as the collection
-
hashCode
public int hashCode() -
equals
-
toImmutable
- Specified by:
toImmutablein interfaceReadOnlyStrictList<E>
-
asList
Description copied from interface:ReadOnlyStrictListReturns the adapter toListinterface for use with 3rd party code or standard Java libraries. Unlike theIterableWithSize.toArrayList()which returns new list containing the same elements, this method returns live "view" of this list instance meaning that changes done to the returned instance are reflected also in the original list. Unless the original list is immutable, in which case all methods modifying the content throwUnsupportedOperationExceptionThe returned list isSerializable- Specified by:
asListin interfaceReadOnlyStrictList<E>
-