Package de.galan.commons.util
Class Sugar
- java.lang.Object
-
- de.galan.commons.util.Sugar
-
public class Sugar extends Object
Simple syntax sugar/shortener
-
-
Constructor Summary
Constructors Constructor Description Sugar()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Tcast(Object x)Casts an object by type inference.<T> Tfallback(T val, T fallback)Returns the given value, or the fallback if the value is null.static <T> Predicate<T>not(Predicate<T> t)Negates the given Predicatestatic <T> Optional<T>optional(T value)Shortens the Optional.ofNullable(..) syntax.
-
-
-
Method Detail
-
optional
public static <T> Optional<T> optional(T value)
Shortens the Optional.ofNullable(..) syntax.
-
fallback
public <T> T fallback(T val, T fallback)Returns the given value, or the fallback if the value is null.
-
-