tips you need to know about guava for simpler and cleaner code without java 8
TRANSCRIPT
Tips you need to know about Guava for simpler and cleaner
code without JAVA 8
黃俊喬( Kosmos Banking)
About Woody
• 黃俊喬 [email protected]
• Worked @ Academia Sinica
• Worked @ B&S Link
• Worked @ HTC
• Work @ Kosmos Banking
• Sample code in Github: https://goo.gl/iVWBiy
Tip 1 Optional – prior to Java 8
Tip 1 Optional – Guava
• Optional in Java 8
Functional Programming
• Function can be used as input parameter or return value:
• Map: Determines the output based on an input value
• Filter: Determines a true or false value for a given input
• Reduce: Processes (using a combiner) a list of elements and generates the return value [Guava doesn’t support for the sake of readability]
Tip 2 Predicate<T> - prior to Java 8
Tip 2 Predicate<T> - Guava
• Predicate in Java 8
Tip 3 Function<F,T> - Guava
• Function in Java 8
Tip 4 FluentIterable - prior to Java 8
Tip 4 FluentIterable - Guava
• stream in Java 8
Tip 5 MultiMap - prior to Java 8
Tip 5 MultiMap - Guava
• stream collector in Java 8
Tip 6 Ordering<T> - prior to Java 8
Tip 6 Ordering<T> - Guava
• Ordering in Java 8
Tip 7 ComparisonChain - Guava
• Comparator.thenComparing in Java 8
Tip 8 ListenableFuture - prior to Java 8
Tip 8 ListenableFuture - Guava
• CompletableFuture in Java 8
Questions & Discussion
Thank You