Class IndexedList<T>
java.lang.Object
org.javimmutable.collections.indexed.IndexedList<T>
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> IndexedList<T> Produces an instance using a copy of the specified List to ensure that changes to the List will not influence the values returned by the instance's methods.find(int index) Retrieves a Holder containing the (possibly null) value at the specified index if it exists.get(int index) Retrieve the value.iterator()static <T> IndexedList<T> Produces an instance using the provided List.intsize()Retrieve the number of values available in the container.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.javimmutable.collections.Indexed
prefix, reversed, transformedMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
copied
Produces an instance using a copy of the specified List to ensure that changes to the List will not influence the values returned by the instance's methods. This is generally preferred to the unsafe() constructor. -
retained
Produces an instance using the provided List. This makes the instance unsafe for sharing since changes to the List will cause changes to this instance's values. However this can be useful when performance is important and the instance will not be shared or retained beyond a single method scope. -
get
Description copied from interface:IndexedRetrieve the value. The index must be valid for the container's current size (i.e. [0-size) -
find
Description copied from interface:IndexedRetrieves a Holder containing the (possibly null) value at the specified index if it exists. If no such value exists returns an empty Holder. -
size
public int size()Description copied from interface:IndexedRetrieve the number of values available in the container. -
iterator
-