public final class ListUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ListUtils.Replacement<T> |
Modifier and Type | Method and Description |
---|---|
static <T> java.util.stream.Collector<T,?,java.util.List<T>> |
joining(java.util.function.Supplier<? extends T> separator) |
static <T> java.util.stream.Collector<T,?,java.util.List<T>> |
joining(java.util.function.Supplier<? extends T> prefix,
java.util.function.Supplier<? extends T> separator,
java.util.function.Supplier<? extends T> suffix)
Creates a collector for interleaving items with a constant separator item, along with prepending and appending
items to bookend the resulting list.
|
static <T> ListUtils.Replacement<T> |
replaceIn(java.util.List<T> list)
Replaces the first instance of an element in a list with another.
|
public static <T> java.util.stream.Collector<T,?,java.util.List<T>> joining(java.util.function.Supplier<? extends T> separator)
public static <T> java.util.stream.Collector<T,?,java.util.List<T>> joining(java.util.function.Supplier<? extends T> prefix, java.util.function.Supplier<? extends T> separator, java.util.function.Supplier<? extends T> suffix)
null
result, no element will be added
for that part of the collection. For example, if prefix
supplies null
, then no element will be
prepended to the list, as opposed to prepending null
.
Each supplier must return consistent, equivalent values. For example, prefix
cannot
return null
on one invocation and "foo"
on another.
public static <T> ListUtils.Replacement<T> replaceIn(java.util.List<T> list)
T
- the type of elements in the listlist
- the list to replace the item in