ZeLiba
ZeLiba is a DSL-ish library to make comparisons more readable. Also, provides pattern-matching for Java 8.
Examples
Comparable<T> val1 = ...
Comparable<T> val2 = ...
if (the(val1).isGreaterThan(val2)) {...}
if (the(val2).isLessThan(val1)) {...}
public static void main(String[] args) {
String language = (args.length == 0) ? "EN" : args[0];
System.out.println(when(language)
.is("EN").then("Hello!")
.is("FE").then("Salut!")
.is("ES").then("Hola!")
.orElse(format("Sorry, I can't greet you in %s yet", language))
);
}
see more Examples