public final class Functions extends Object
| Modifier and Type | Field and Description |
|---|---|
static DoubleFunction<AtomicLong> |
AGE
Age function based on the system clock.
|
static ValueFunction<Collection<?>> |
COLLECTION_SIZE
Deprecated.
Use
Collection::size instead. |
static DoubleFunction<? extends Number> |
IDENTITY
Identity function that just returns the passed in value if it implements the
Number interface. |
static ValueFunction<Map<?,?>> |
MAP_SIZE
Deprecated.
Use
Map::size instead. |
| Modifier and Type | Method and Description |
|---|---|
static DoubleFunction<AtomicLong> |
age(Clock clock)
Returns a function that computes the age in seconds.
|
static <T> java.util.function.ToDoubleFunction<T> |
invokeMethod(Method method)
Returns a function that invokes a method on the object via reflection.
|
static java.util.function.Predicate<Meter> |
nameEquals(String name)
Returns a predicate that matches if the {code}id.name(){code} value for the input meter
is equal to {code}name{code}.
|
public static final DoubleFunction<? extends Number> IDENTITY
Number interface.@Deprecated public static final ValueFunction<Collection<?>> COLLECTION_SIZE
Collection::size instead.@Deprecated public static final ValueFunction<Map<?,?>> MAP_SIZE
Map::size instead.public static final DoubleFunction<AtomicLong> AGE
age(Clock) for more details.public static DoubleFunction<AtomicLong> age(Clock clock)
System.currentTimeMillis().clock - Clock used to get the current time for comparing with the passed in value.public static <T> java.util.function.ToDoubleFunction<T> invokeMethod(Method method)
Number. The method will be set accessible so that private
methods can be used.method - Method to execute on the passed in object.public static java.util.function.Predicate<Meter> nameEquals(String name)
long numberOfMatches = registry.stream().filter(Functions.nameEquals("foo")).count();
name - The name to use for finding matching meter instances. Cannot be null.