public class Augmentation
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> boolean |
any(java.lang.Iterable<T> receiver,
java.util.function.Predicate<T> predicate)
Iterates over the contents of an iterable, and checks whether a predicate is valid for at least one element.
|
static <T> java.util.Collection<T> |
asCollection(java.lang.Iterable<T> receiver)
Converts this Iterable to a Collection.
|
static <T> java.util.List<T> |
asList(java.lang.Iterable<T> receiver)
Converts this Iterable to a List.
|
static <T,U> java.lang.Object |
collect(java.util.Collection<T> receiver,
java.util.Collection<U> collection,
java.util.function.Function<T,U> function)
Iterates through this collection transforming each entry into a new value using
the function, adding the values to the specified collection.
|
static <T,U> java.util.List<U> |
collect(java.util.Collection<T> receiver,
java.util.function.Function<T,U> function)
Iterates through this collection transforming each entry into a new value using
the function, returning a list of transformed values.
|
static <K,V,T> java.util.List<T> |
collect(java.util.Map<K,V> receiver,
java.util.function.BiFunction<K,V,T> function)
Iterates through this map transforming each entry into a new value using
the function, returning a list of transformed values.
|
static <K,V,T> java.lang.Object |
collect(java.util.Map<K,V> receiver,
java.util.Collection<T> collection,
java.util.function.BiFunction<K,V,T> function)
Iterates through this map transforming each entry into a new value using
the function, adding the values to the specified collection.
|
static <T> int |
count(java.lang.Iterable<T> receiver,
java.util.function.Predicate<T> predicate)
Counts the number of occurrences which satisfy the given predicate from inside this Iterable.
|
static <K,V> int |
count(java.util.Map<K,V> receiver,
java.util.function.BiPredicate<K,V> predicate)
Counts the number of occurrences which satisfy the given predicate from inside this Map
|
static java.lang.String |
decodeBase64(java.lang.String receiver)
Decode some Base64 bytes and build a UTF-8 encoded string.
|
static <T> java.lang.Object |
each(java.lang.Iterable<T> receiver,
java.util.function.Consumer<T> consumer)
Iterates through an Iterable, passing each item to the given consumer.
|
static <K,V> java.lang.Object |
each(java.util.Map<K,V> receiver,
java.util.function.BiConsumer<K,V> consumer)
Iterates through a Map, passing each item to the given consumer.
|
static <T> java.lang.Object |
eachWithIndex(java.lang.Iterable<T> receiver,
java.util.function.ObjIntConsumer<T> consumer)
Iterates through an iterable type, passing each item and the item's index
(a counter starting at zero) to the given consumer.
|
static java.lang.String |
encodeBase64(java.lang.String receiver)
Encode a String in Base64.
|
static <T> boolean |
every(java.lang.Iterable<T> receiver,
java.util.function.Predicate<T> predicate)
Used to determine if the given predicate is valid (i.e.
|
static <K,V> boolean |
every(java.util.Map<K,V> receiver,
java.util.function.BiPredicate<K,V> predicate)
Used to determine if the given predicate is valid (i.e.
|
static <T> T |
find(java.util.Collection<T> receiver,
java.util.function.Predicate<T> predicate)
Finds the first value matching the predicate, or returns null.
|
static <K,V> java.util.Map.Entry<K,V> |
find(java.util.Map<K,V> receiver,
java.util.function.BiPredicate<K,V> predicate)
Finds the first entry matching the predicate, or returns null.
|
static <T> java.util.List<T> |
findAll(java.util.Collection<T> receiver,
java.util.function.Predicate<T> predicate)
Finds all values matching the predicate, returns as a list
|
static <K,V> java.util.Map<K,V> |
findAll(java.util.Map<K,V> receiver,
java.util.function.BiPredicate<K,V> predicate)
Finds all values matching the predicate, returns as a map.
|
static <T,U> java.lang.Object |
findResult(java.util.Collection<T> receiver,
java.util.function.Function<T,U> function)
Iterates through the collection calling the given function for each item
but stopping once the first non-null result is found and returning that result.
|
static <T,U> java.lang.Object |
findResult(java.util.Collection<T> receiver,
java.lang.Object defaultResult,
java.util.function.Function<T,U> function)
Iterates through the collection calling the given function for each item
but stopping once the first non-null result is found and returning that result.
|
static <K,V,T> java.lang.Object |
findResult(java.util.Map<K,V> receiver,
java.util.function.BiFunction<K,V,T> function)
Iterates through the map calling the given function for each item
but stopping once the first non-null result is found and returning that result.
|
static <K,V,T> java.lang.Object |
findResult(java.util.Map<K,V> receiver,
java.lang.Object defaultResult,
java.util.function.BiFunction<K,V,T> function)
Iterates through the map calling the given function for each item
but stopping once the first non-null result is found and returning that result.
|
static <T,U> java.util.List<U> |
findResults(java.lang.Iterable<T> receiver,
java.util.function.Function<T,U> filter)
Iterates through the Iterable transforming items using the supplied function and
collecting any non-null results.
|
static <K,V,T> java.util.List<T> |
findResults(java.util.Map<K,V> receiver,
java.util.function.BiFunction<K,V,T> filter)
Iterates through the map transforming items using the supplied function and
collecting any non-null results.
|
static <T> int |
getLength(java.util.List<T> receiver)
Exposes List.size() as getLength(), so that .length shortcut works on lists
|
static <T,U> java.util.Map<U,java.util.List<T>> |
groupBy(java.lang.Iterable<T> receiver,
java.util.function.Function<T,U> mapper)
Sorts all Iterable members into groups determined by the supplied mapping function.
|
static <K,V,T> java.util.Map<T,java.util.Map<K,V>> |
groupBy(java.util.Map<K,V> receiver,
java.util.function.BiFunction<K,V,T> mapper)
Sorts all Map members into groups determined by the supplied mapping function.
|
static <T> java.lang.String |
join(java.lang.Iterable<T> receiver,
java.lang.String separator)
Concatenates the toString() representation of each item in this Iterable,
with the given String as a separator between each item.
|
static java.lang.String |
namedGroup(java.util.regex.Matcher receiver,
java.lang.String name)
Exposes Matcher.group(String) as namedGroup(String), so it doesn't conflict with group(int)
|
static java.lang.String |
replaceAll(java.lang.CharSequence receiver,
java.util.regex.Pattern pattern,
java.util.function.Function<java.util.regex.Matcher,java.lang.String> replacementBuilder)
Replace all matches.
|
static java.lang.String |
replaceFirst(java.lang.CharSequence receiver,
java.util.regex.Pattern pattern,
java.util.function.Function<java.util.regex.Matcher,java.lang.String> replacementBuilder)
Replace the first match.
|
static <T> java.util.List<java.util.List<T>> |
split(java.util.Collection<T> receiver,
java.util.function.Predicate<T> predicate)
Splits all items into two collections based on the predicate.
|
static <T extends java.lang.Number> |
sum(java.lang.Iterable<T> receiver)
Sums the result of an Iterable
|
static <T> double |
sum(java.lang.Iterable<T> receiver,
java.util.function.ToDoubleFunction<T> function)
Sums the result of applying a function to each item of an Iterable.
|
public static <T> int getLength(java.util.List<T> receiver)
public static java.lang.String namedGroup(java.util.regex.Matcher receiver, java.lang.String name)
public static <T> boolean any(java.lang.Iterable<T> receiver, java.util.function.Predicate<T> predicate)
public static <T> java.util.Collection<T> asCollection(java.lang.Iterable<T> receiver)
public static <T> java.util.List<T> asList(java.lang.Iterable<T> receiver)
public static <T> int count(java.lang.Iterable<T> receiver, java.util.function.Predicate<T> predicate)
public static <T> java.lang.Object each(java.lang.Iterable<T> receiver, java.util.function.Consumer<T> consumer)
public static <T> java.lang.Object eachWithIndex(java.lang.Iterable<T> receiver, java.util.function.ObjIntConsumer<T> consumer)
public static <T> boolean every(java.lang.Iterable<T> receiver, java.util.function.Predicate<T> predicate)
public static <T,U> java.util.List<U> findResults(java.lang.Iterable<T> receiver, java.util.function.Function<T,U> filter)
public static <T,U> java.util.Map<U,java.util.List<T>> groupBy(java.lang.Iterable<T> receiver, java.util.function.Function<T,U> mapper)
public static <T> java.lang.String join(java.lang.Iterable<T> receiver, java.lang.String separator)
public static <T extends java.lang.Number> double sum(java.lang.Iterable<T> receiver)
public static <T> double sum(java.lang.Iterable<T> receiver, java.util.function.ToDoubleFunction<T> function)
public static <T,U> java.util.List<U> collect(java.util.Collection<T> receiver, java.util.function.Function<T,U> function)
public static <T,U> java.lang.Object collect(java.util.Collection<T> receiver, java.util.Collection<U> collection, java.util.function.Function<T,U> function)
public static <T> T find(java.util.Collection<T> receiver, java.util.function.Predicate<T> predicate)
public static <T> java.util.List<T> findAll(java.util.Collection<T> receiver, java.util.function.Predicate<T> predicate)
public static <T,U> java.lang.Object findResult(java.util.Collection<T> receiver, java.util.function.Function<T,U> function)
public static <T,U> java.lang.Object findResult(java.util.Collection<T> receiver, java.lang.Object defaultResult, java.util.function.Function<T,U> function)
public static <T> java.util.List<java.util.List<T>> split(java.util.Collection<T> receiver, java.util.function.Predicate<T> predicate)
public static <K,V,T> java.util.List<T> collect(java.util.Map<K,V> receiver, java.util.function.BiFunction<K,V,T> function)
public static <K,V,T> java.lang.Object collect(java.util.Map<K,V> receiver, java.util.Collection<T> collection, java.util.function.BiFunction<K,V,T> function)
public static <K,V> int count(java.util.Map<K,V> receiver, java.util.function.BiPredicate<K,V> predicate)
public static <K,V> java.lang.Object each(java.util.Map<K,V> receiver, java.util.function.BiConsumer<K,V> consumer)
public static <K,V> boolean every(java.util.Map<K,V> receiver, java.util.function.BiPredicate<K,V> predicate)
public static <K,V> java.util.Map.Entry<K,V> find(java.util.Map<K,V> receiver, java.util.function.BiPredicate<K,V> predicate)
public static <K,V> java.util.Map<K,V> findAll(java.util.Map<K,V> receiver, java.util.function.BiPredicate<K,V> predicate)
public static <K,V,T> java.lang.Object findResult(java.util.Map<K,V> receiver, java.util.function.BiFunction<K,V,T> function)
public static <K,V,T> java.lang.Object findResult(java.util.Map<K,V> receiver, java.lang.Object defaultResult, java.util.function.BiFunction<K,V,T> function)
public static <K,V,T> java.util.List<T> findResults(java.util.Map<K,V> receiver, java.util.function.BiFunction<K,V,T> filter)
public static <K,V,T> java.util.Map<T,java.util.Map<K,V>> groupBy(java.util.Map<K,V> receiver, java.util.function.BiFunction<K,V,T> mapper)
public static java.lang.String replaceAll(java.lang.CharSequence receiver, java.util.regex.Pattern pattern, java.util.function.Function<java.util.regex.Matcher,java.lang.String> replacementBuilder)
Matcher.replaceAll(String)
but allows you to customize the replacement based on the match.public static java.lang.String replaceFirst(java.lang.CharSequence receiver, java.util.regex.Pattern pattern, java.util.function.Function<java.util.regex.Matcher,java.lang.String> replacementBuilder)
Matcher.replaceFirst(String)
but allows you to customize the replacement based on the
match.public static java.lang.String encodeBase64(java.lang.String receiver)
Base64.Encoder#encodeToString(byte[])
if you have to encode bytes rather than a string.public static java.lang.String decodeBase64(java.lang.String receiver)
Base64.Decoder#decode(String)
if you'd prefer bytes to work
with bytes.