Package org.cactoos.scalar
Class LowestOf<T extends Comparable<? super T>>
- java.lang.Object
-
- org.cactoos.scalar.ScalarEnvelope<T>
-
- org.cactoos.scalar.LowestOf<T>
-
- Type Parameters:
T
- Scalar type
- All Implemented Interfaces:
Scalar<T>
public final class LowestOf<T extends Comparable<? super T>> extends ScalarEnvelope<T>
Find the lowest item.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 checkedException
. This may not be convenient in many cases. To make it more convenient and get rid of the checked exception you can use theUnchecked
decorator. Or you may useIoChecked
to wrap it in an IOException.There is no thread-safety guarantee.
-
-
Constructor Detail
-
LowestOf
@SafeVarargs public LowestOf(T... items)
Ctor.- Parameters:
items
- The comparable items
-
LowestOf
@SafeVarargs public LowestOf(Scalar<? extends T>... scalars)
Ctor.- Parameters:
scalars
- The scalars
-
-