public class Iterables2 extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Iterable<T> |
distinct(Iterable<T> iterable)
If we can assume the iterable is sorted, return the distinct elements.
|
static <T> Iterable<List<T>> |
groupBy(Iterable<? extends T> iterable,
Function<? super T,?> groupingFunction)
Divides an iterable into unmodifiable sublists of equivalent elements.
|
static <T> Iterable<T> |
simpleIterable(Iterable<T> iterable)
Wraps any iterable into a generic iterable object.
|
public static <T> Iterable<T> simpleIterable(Iterable<T> iterable)
public static <T> Iterable<T> distinct(Iterable<T> iterable)
public static <T> Iterable<List<T>> groupBy(Iterable<? extends T> iterable, Function<? super T,?> groupingFunction)
[1, 3, 2, 4, 5] with a function grouping even and odd numbers
yields [[1, 3], [2, 4], [5] all in the original order.
The returned lists implement RandomAccess.
Copyright © 2018 Calrissian. All rights reserved.