| Modifier and Type | Method and Description |
|---|---|
| public ParallelListIterable | asParallel(ExecutorService executorService, int batchSize)
Returns a parallel iterable of this ListIterable. |
| public default int | binarySearch(T key, Comparator<? super T> comparator)
Searches for the specified object using the binary search algorithm. |
| public default int | |
| public <V> ListIterable | collect(Function<? super T, ? extends V> function)
Redeclares org. Returns a new collection with the results of applying the specified function on each element of the source collection. |
| public BooleanList | collectBoolean(BooleanFunction<? super T> booleanFunction)
Redeclares org. Returns a new primitive |
| public ByteList | collectByte(ByteFunction<? super T> byteFunction)
Redeclares org. Returns a new primitive |
| public CharList | collectChar(CharFunction<? super T> charFunction)
Redeclares org. Returns a new primitive |
| public DoubleList | collectDouble(DoubleFunction<? super T> doubleFunction)
Redeclares org. Returns a new primitive |
| public FloatList | collectFloat(FloatFunction<? super T> floatFunction)
Redeclares org. Returns a new primitive |
| public <V> ListIterable | collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)
Redeclares org. Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. |
| public IntList | collectInt(IntFunction<? super T> intFunction)
Redeclares org. Returns a new primitive |
| public LongList | collectLong(LongFunction<? super T> longFunction)
Redeclares org. Returns a new primitive |
| public ShortList | collectShort(ShortFunction<? super T> shortFunction)
Redeclares org. Returns a new primitive |
| public <P, V> ListIterable | collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)
Redeclares org. Same as |
| public default <V> ListIterable | collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)
Overrides default org. Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index. |
| public ListIterable | Returns: ListIterable of distinct elementsRedeclares org. Returns a new |
| public ListIterable | Returns: ListIterable of distinct elementsReturns a new |
| public <V> ListIterable | distinctBy(Function<? super T, ? extends V> function)
Returns a new |
| public ListIterable | drop(int count)
Redeclares org. Returns an iterable after skipping the first |
| public ListIterable | dropWhile(Predicate<? super T> predicate)
Redeclares org. Returns the final elements that do not satisfy the Predicate. |
| public boolean | |
| public <V> ListIterable | flatCollect(Function<? super T, ? extends Iterable<V>> function)
Redeclares org.
|
| public default <P, V> ListIterable | flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)
Overrides default org. Same as flatCollect, only with a Function2 that is passed an extra parameter. |
| public default <T2> void | forEachInBoth(ListIterable<T2> other, Procedure2<? super T, ? super T2> procedure)
Iterates over this ListIterable and the other ListIterable together passing the elements of each list as parameters to the specified procedure. |
| public T | |
| public T | getFirst()
Redeclares org. Returns the item at index 0 of the container. |
| public T | getLast()
Redeclares org. Returns the item at index (size() - 1) of the container. |
| public <V> ListMultimap | groupBy(Function<? super T, ? extends V> function)
Redeclares org. For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable. |
| public <V> ListMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function)
Redeclares org. Similar to |
| public int | |
| public int | lastIndexOf(Object o)
Returns the index of the last occurrence of the specified item in this list, or -1 if this list does not contain the item. |
| public ListIterator | |
| public ListIterator | |
| public PartitionList | partition(Predicate<? super T> predicate)
Redeclares org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. |
| public PartitionList | partitionWhile(Predicate<? super T> predicate)
Redeclares org. Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. |
| public <P> PartitionList | partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Filters a collection into a PartitionIterable based on the evaluation of the predicate. |
| public ListIterable | reject(Predicate<? super T> predicate)
Redeclares org. Returns all elements of the source collection that return false when evaluating of the predicate. |
| public <P> ListIterable | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public default ListIterable | rejectWithIndex(ObjectIntPredicate<? super T> predicate)
Returns a new ListIterable with all elements of the collection that return false when evaluating the specified predicate which is supplied each element and its relative index. |
| public ListIterable | select(Predicate<? super T> predicate)
Redeclares org. Returns all elements of the source collection that return true when evaluating the predicate. |
| public <S> ListIterable | selectInstancesOf(Class<S> clazz)
Redeclares org. Returns all elements of the source collection that are instances of the Class |
| public <P> ListIterable | selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public default ListIterable | selectWithIndex(ObjectIntPredicate<? super T> predicate)
Returns a new ListIterable with all elements of the collection that return true when evaluating the specified predicate which is supplied each element and its relative index. |
| public ListIterable | |
| public ListIterable | take(int count)
Redeclares org. Returns the first |
| public ListIterable | takeWhile(Predicate<? super T> predicate)
Redeclares org. Returns the initial elements that satisfy the Predicate. |
| public ListIterable | tap(Procedure<? super T> procedure)
Redeclares org. Executes the Procedure for each element in the iterable and returns |
| public ImmutableList | |
| public ListIterable | toReversed()
Redeclares org. Returns a new ReversibleIterable in reverse order. |
| public <S> ListIterable | zip(Iterable<S> that)
Redeclares org. Returns a |
| public ListIterable | zipWithIndex()
Redeclares org. Zips this |
| asParallel | back to summary |
|---|---|
| public ParallelListIterable Returns a parallel iterable of this ListIterable.
| |
| binarySearch | back to summary |
|---|---|
| public default int binarySearch(T key, Comparator<? super T> comparator) Searches for the specified object using the binary search algorithm. The list must be sorted into ascending order according to the specified comparator. | |
| binarySearch | back to summary |
|---|---|
| public default int binarySearch(T key) Searches for the specified object using the binary search algorithm. The elements in this list must implement Comparable and the list must be sorted into ascending order. | |
| collect | back to summary |
|---|---|
| public <V> ListIterable Redeclares org. Doc from org. Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map. Example using a Java 8 lambda expression:
RichIterable<String> names =
people.collect(person -> person.getFirstName() + " " + person.getLastName());
| |
| collectBoolean | back to summary |
|---|---|
| public BooleanList collectBoolean(BooleanFunction<? super T> booleanFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
BooleanIterable licenses =
people.collectBoolean(person -> person.hasDrivingLicense());
| |
| collectByte | back to summary |
|---|---|
| public ByteList collectByte(ByteFunction<? super T> byteFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
ByteIterable bytes =
people.collectByte(person -> person.getCode());
| |
| collectChar | back to summary |
|---|---|
| public CharList collectChar(CharFunction<? super T> charFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
CharIterable chars =
people.collectChar(person -> person.getMiddleInitial());
| |
| collectDouble | back to summary |
|---|---|
| public DoubleList collectDouble(DoubleFunction<? super T> doubleFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
DoubleIterable doubles =
people.collectDouble(person -> person.getMilesFromNorthPole());
| |
| collectFloat | back to summary |
|---|---|
| public FloatList collectFloat(FloatFunction<? super T> floatFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
FloatIterable floats =
people.collectFloat(person -> person.getHeightInInches());
| |
| collectIf | back to summary |
|---|---|
| public <V> ListIterable Redeclares org. Doc from org. Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. This is the optimized equivalent of calling iterable.select(predicate).collect(function). Example using a Java 8 lambda and method reference: RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString); Example using Predicates factory: RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
| |
| collectInt | back to summary |
|---|---|
| public IntList collectInt(IntFunction<? super T> intFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
IntIterable ints =
people.collectInt(person -> person.getAge());
| |
| collectLong | back to summary |
|---|---|
| public LongList collectLong(LongFunction<? super T> longFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
LongIterable longs =
people.collectLong(person -> person.getGuid());
| |
| collectShort | back to summary |
|---|---|
| public ShortList collectShort(ShortFunction<? super T> shortFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
ShortIterable shorts =
people.collectShort(person -> person.getNumberOfJunkMailItemsReceivedPerMonth());
| |
| collectWith | back to summary |
|---|---|
| public <P, V> ListIterable Redeclares org. Doc from org. Same as Example using a Java 8 lambda expression:
RichIterable<Integer> integers =
Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1));
| |
| collectWithIndex | back to summary |
|---|---|
| public default <V> ListIterable Overrides default org. Doc from org. Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.
| |
| distinct | back to summary |
|---|---|
| public ListIterable Redeclares org. Returns a new
Conceptually similar to
| |
| distinct | back to summary |
|---|---|
| public ListIterable Returns a new
| |
| distinctBy | back to summary |
|---|---|
| public <V> ListIterable Returns a new
| |
| drop | back to summary |
|---|---|
| public ListIterable Redeclares org. Doc from org. Returns an iterable after skipping the first
| |
| dropWhile | back to summary |
|---|---|
| public ListIterable Redeclares org. Returns the final elements that do not satisfy the Predicate. Short circuits at the first element which does satisfy the Predicate.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Follows the same general contract as
| |
| flatCollect | back to summary |
|---|---|
| public <V> ListIterable Redeclares org. Doc from org.
Consider the following example where we have a Function<Person, List<Address>> addressFunction = Person::getAddresses; RichIterable<Person> people = ...;Using collect returns a collection of collections of addresses.
RichIterable<List<Address>> addresses = people.collect(addressFunction);Using flatCollect returns a single flattened list of addresses.
RichIterable<Address> addresses = people.flatCollect(addressFunction);
| |
| flatCollectWith | back to summary |
|---|---|
| public default <P, V> ListIterable Overrides default org. Doc from org. Same as flatCollect, only with a Function2 that is passed an extra parameter.
| |
| forEachInBoth | back to summary |
|---|---|
| public default <T2> void forEachInBoth(ListIterable<T2> other, Procedure2<? super T, ? super T2> procedure) Iterates over this ListIterable and the other ListIterable together passing the elements of each list as parameters to the specified procedure.
| |
| get | back to summary |
|---|---|
| public T get(int index) Returns the item at the specified position in this list iterable. | |
| getFirst | back to summary |
|---|---|
| public T getFirst() Redeclares org. Returns the item at index 0 of the container. If the container is empty, null is returned. If null is a valid item of the container, then a developer will need to check to see if the container is empty first.
| |
| getLast | back to summary |
|---|---|
| public T getLast() Redeclares org. Returns the item at index (size() - 1) of the container. If the container is empty, null is returned. If null is a valid item of the container, then a developer will need to check to see if the container is empty first.
| |
| groupBy | back to summary |
|---|---|
| public <V> ListMultimap Redeclares org. Doc from org. For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable. Example using a Java 8 method reference:
Multimap<String, Person> peopleByLastName =
people.groupBy(Person::getLastName);
| |
| groupByEach | back to summary |
|---|---|
| public <V> ListMultimap Redeclares org. Doc from org. Similar to
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Follows the same general contract as
| |
| lastIndexOf | back to summary |
|---|---|
| public int lastIndexOf(Object o) Returns the index of the last occurrence of the specified item in this list, or -1 if this list does not contain the item. | |
| listIterator | back to summary |
|---|---|
public ListIterator
| |
| listIterator | back to summary |
|---|---|
public ListIterator
| |
| partition | back to summary |
|---|---|
| public PartitionList Redeclares org. Doc from org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers =
people.partition(person -> person.getAddress().getState().getName().equals("New York"));
| |
| partitionWhile | back to summary |
|---|---|
| public PartitionList Redeclares org. Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. Short circuits at the first element which does satisfy the Predicate.
| |
| partitionWith | back to summary |
|---|---|
| public <P> PartitionList Redeclares org. Doc from org. Filters a collection into a PartitionIterable based on the evaluation of the predicate. Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers =
people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
| |
| reject | back to summary |
|---|---|
| public ListIterable Redeclares org. Doc from org. Returns all elements of the source collection that return false when evaluating of the predicate. This method is also sometimes called filterNot and is the equivalent of calling iterable.select(Predicates.not(predicate)). Example using a Java 8 lambda expression:
RichIterable<Person> rejected =
people.reject(person -> person.person.getLastName().equals("Smith"));
| |
| rejectWith | back to summary |
|---|---|
| public <P> ListIterable Redeclares org. Doc from org. Similar to
E.g. return a Example using a Java 8 lambda expression:
RichIterable<Person> rejected =
people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18));
| |
| rejectWithIndex | back to summary |
|---|---|
| public default ListIterable Returns a new ListIterable with all elements of the collection that return false when evaluating the specified predicate which is supplied each element and its relative index.
| |
| select | back to summary |
|---|---|
| public ListIterable Redeclares org. Doc from org. Returns all elements of the source collection that return true when evaluating the predicate. This method is also commonly called filter. Example using a Java 8 lambda expression:
RichIterable<Person> selected =
people.select(person -> person.getAddress().getCity().equals("London"));
| |
| selectInstancesOf | back to summary |
|---|---|
| public <S> ListIterable Redeclares org. Doc from org. Returns all elements of the source collection that are instances of the Class
RichIterable<Integer> integers =
List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
| |
| selectWith | back to summary |
|---|---|
| public <P> ListIterable Redeclares org. Doc from org. Similar to
E.g. return a Example using a Java 8 lambda expression:
RichIterable<Person> selected =
people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18));
| |
| selectWithIndex | back to summary |
|---|---|
| public default ListIterable Returns a new ListIterable with all elements of the collection that return true when evaluating the specified predicate which is supplied each element and its relative index.
| |
| subList | back to summary |
|---|---|
public ListIterable
| |
| take | back to summary |
|---|---|
| public ListIterable Redeclares org. Doc from org. Returns the first
| |
| takeWhile | back to summary |
|---|---|
| public ListIterable Redeclares org. Returns the initial elements that satisfy the Predicate. Short circuits at the first element which does not satisfy the Predicate.
| |
| tap | back to summary |
|---|---|
| public ListIterable Redeclares org. Doc from org. Executes the Procedure for each element in the iterable and returns Example using a Java 8 lambda expression:
RichIterable<Person> tapped =
people.tap(person -> LOGGER.info(person.getName()));
| |
| toImmutable | back to summary |
|---|---|
| public ImmutableList Converts the ListIterable to an immutable implementation. Returns this for immutable lists.
| |
| toReversed | back to summary |
|---|---|
| public ListIterable Redeclares org. Doc from org. Returns a new ReversibleIterable in reverse order.
| |
| zip | back to summary |
|---|---|
| public <S> ListIterable Redeclares org. Doc from org. Returns a
| |
| zipWithIndex | back to summary |
|---|---|
| public ListIterable Redeclares org. Doc from org. Zips this
| |