java.util.stream.Collectors that are not otherwise associated
with a com.google.common type.
| Modifier and Type | Class and Description |
|---|---|
| private static class | MoreCollectors.ToOptionalState
This atrocity is here to let us report several of the elements in the stream if there were more than one, not just two. |
| Modifier and Type | Field and Description |
|---|---|
| private static final Object | |
| private static final Collector | |
| private static final Collector |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <T extends @Nullable Object> Collector | onlyElement()
A collector that takes a stream containing exactly one element and returns that element. |
| public static <T> Collector | Returns: Optional.of(onlyElement) if the stream has exactly one element (must not be
null) and returns Optional.empty() if it has none.A collector that converts a stream of zero or one elements to an |
| NULL_PLACEHOLDER | back to summary |
|---|---|
| private static final Object NULL_PLACEHOLDER | |
| ONLY_ELEMENT | back to summary |
|---|---|
| private static final Collector<@Nullable Object, ?, @Nullable Object> ONLY_ELEMENT | |
| TO_OPTIONAL | back to summary |
|---|---|
| private static final Collector<Object, ?, Optional<Object>> TO_OPTIONAL | |
| MoreCollectors | back to summary |
|---|---|
| private MoreCollectors() | |
| onlyElement | back to summary |
|---|---|
| public static <T extends @Nullable Object> Collector A collector that takes a stream containing exactly one element and returns that element. The
returned collector throws an
| |
| toOptional | back to summary |
|---|---|
| public static <T> Collector A collector that converts a stream of zero or one elements to an
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Object | |
| pack-priv List | |
| pack-priv static final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv MoreCollectors. | |
| pack-priv Object | |
| pack-priv Optional | |
| pack-priv IllegalArgumentException |
| element | back to summary |
|---|---|
| pack-priv Object element
| |
| extras | back to summary |
|---|---|
| pack-priv List<Object> extras | |
| MAX_EXTRAS | back to summary |
|---|---|
| pack-priv static final int MAX_EXTRAS | |
| ToOptionalState | back to summary |
|---|---|
| pack-priv ToOptionalState() | |
| add | back to summary |
|---|---|
| pack-priv void add(Object o) | |
| combine | back to summary |
|---|---|
| pack-priv MoreCollectors. | |
| getElement | back to summary |
|---|---|
| pack-priv Object getElement() | |
| getOptional | back to summary |
|---|---|
| pack-priv Optional | |
| multiples | back to summary |
|---|---|
| pack-priv IllegalArgumentException multiples(boolean overflow) | |