comparator() or is the natural
ordering if comparator() returns null. Operations that would sort the collection can be faster than
O(n log n). For example toSortedList() takes O(n) time.
| Modifier and Type | Method and Description |
|---|---|
| public Comparator | comparator()
Returns the comparator used to order the elements in this container, or null if this container uses the natural ordering of its elements. |
| public SortedIterable | Returns: SortedIterable of distinct elementsRedeclares org. Returns a new |
| public SortedIterable | dropWhile(Predicate<? super T> predicate)
Redeclares org. Returns the final elements that do not satisfy the Predicate. |
| public <V> SortedIterableMultimap | 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> SortedIterableMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function)
Redeclares org. Similar to |
| public T | max()
Redeclares org. Returns the maximum element out of this container based on the natural order, not the order of this container. |
| public T | min()
Redeclares org. Returns the minimum element out of this container based on the natural order, not the order of this container. |
| public PartitionSortedIterable | partition(Predicate<? super T> predicate)
Redeclares org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. |
| public PartitionSortedIterable | partitionWhile(Predicate<? super T> predicate)
Redeclares org. Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. |
| public SortedIterable | reject(Predicate<? super T> predicate)
Redeclares org. Returns all elements of the source collection that return false when evaluating of the predicate. |
| public <P> SortedIterable | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public SortedIterable | select(Predicate<? super T> predicate)
Redeclares org. Returns all elements of the source collection that return true when evaluating the predicate. |
| public <S> SortedIterable | selectInstancesOf(Class<S> clazz)
Redeclares org. Returns all elements of the source collection that are instances of the Class |
| public <P> SortedIterable | selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public SortedIterable | takeWhile(Predicate<? super T> predicate)
Redeclares org. Returns the initial elements that satisfy the Predicate. |
| public SortedIterable | tap(Procedure<? super T> procedure)
Redeclares org. Executes the Procedure for each element in the iterable and returns |
| public <S> ListIterable | zip(Iterable<S> that)
Redeclares org. Returns a |
| public SortedIterable | zipWithIndex()
Redeclares org. Zips this |
| comparator | back to summary |
|---|---|
| public Comparator Returns the comparator used to order the elements in this container, or null if this container uses the natural ordering of its elements. | |
| distinct | back to summary |
|---|---|
| public SortedIterable Redeclares org. Returns a new
Conceptually similar to
| |
| dropWhile | back to summary |
|---|---|
| public SortedIterable Redeclares org. Returns the final elements that do not satisfy the Predicate. Short circuits at the first element which does satisfy the Predicate.
| |
| groupBy | back to summary |
|---|---|
| public <V> SortedIterableMultimap 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> SortedIterableMultimap Redeclares org. Doc from org. Similar to
| |
| max | back to summary |
|---|---|
| public T max() Redeclares org. Returns the maximum element out of this container based on the natural order, not the order of this container.
If you want the maximum element based on the order of this container, use
| |
| min | back to summary |
|---|---|
| public T min() Redeclares org. Returns the minimum element out of this container based on the natural order, not the order of this container.
If you want the minimum element based on the order of this container, use
| |
| partition | back to summary |
|---|---|
| public PartitionSortedIterable 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 PartitionSortedIterable 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.
| |
| reject | back to summary |
|---|---|
| public SortedIterable 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> SortedIterable 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));
| |
| select | back to summary |
|---|---|
| public SortedIterable 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> SortedIterable 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> SortedIterable 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));
| |
| takeWhile | back to summary |
|---|---|
| public SortedIterable 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 SortedIterable 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()));
| |
| zip | back to summary |
|---|---|
| public <S> ListIterable Redeclares org. Doc from org. Returns a
| |
| zipWithIndex | back to summary |
|---|---|
| public SortedIterable Redeclares org. Doc from org. Zips this
| |