T
- Scalar typepublic final class LowestOf<T extends Comparable<T>> extends Object implements Scalar<T>
Here is how you can use it to
find lowest of Comparable
items:
final String lowest = new LowestOf<String>( () -> "Banana", () -> "Apple", () -> "Orange" ).value(); // -> lowest == "Apple" final Character lowestChar = new LowestOf<>('B', 'U', 'G').value(); // -> lowestChar == 'B'
This class implements Scalar
, which throws a checked
Exception
. This may not be convenient in many cases. To make
it more convenient and get rid of the checked exception you can
use UncheckedScalar
or IoCheckedScalar
decorators.
There is no thread-safety guarantee.
UncheckedScalar
,
IoCheckedScalar
@SafeVarargs public LowestOf(T... items)
items
- The comparable items@SafeVarargs public LowestOf(Scalar<T>... scalars)
scalars
- The scalarsCopyright © 2017–2018 Cactoos. All rights reserved.