Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Tips you need to know about guava for simpler and cleaner code without JAVA 8

629 views

Published on

Java 8 provides lots of great features. Though, not every project can be upgraded. In this case, Guava is the right chose for you. In this talk, I will show you some tips about writing simpler and cleaner code using Guava

Published in: Software
  • Be the first to comment

Tips you need to know about guava for simpler and cleaner code without JAVA 8

  1. 1. Tips you need to know about Guava for simpler and cleaner code without JAVA 8 黃俊喬(Kosmos Banking)
  2. 2. About Woody • 黃俊喬 woody.huang@kosmossystems.com • Worked @ Academia Sinica • Worked @ B&S Link • Worked @ HTC • Work @ Kosmos Banking • Sample code in Github: https://goo.gl/iVWBiy
  3. 3. Tip 1 Optional – prior to Java 8
  4. 4. Tip 1 Optional – Guava • Optional in Java 8
  5. 5. 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]
  6. 6. Tip 2 Predicate<T> - prior to Java 8
  7. 7. Tip 2 Predicate<T> - Guava • Predicate in Java 8
  8. 8. Tip 3 Function<F,T> - Guava • Function in Java 8
  9. 9. Tip 4 FluentIterable - prior to Java 8
  10. 10. Tip 4 FluentIterable - Guava • stream in Java 8
  11. 11. Tip 5 MultiMap - prior to Java 8
  12. 12. Tip 5 MultiMap - Guava • stream collector in Java 8
  13. 13. Tip 6 Ordering<T> - prior to Java 8
  14. 14. Tip 6 Ordering<T> - Guava • Ordering in Java 8
  15. 15. Tip 7 ComparisonChain - Guava • Comparator.thenComparing in Java 8
  16. 16. Tip 8 ListenableFuture - prior to Java 8
  17. 17. Tip 8 ListenableFuture - Guava • CompletableFuture in Java 8
  18. 18. Questions & Discussion
  19. 19. Thank You

×