Planview Blog

Your path to business agility

Engineering Teams

Java 8 Eclipse Templates

Published By Tasktop Blogger
Java 8 Eclipse Templates

It’s been a while since Java 8 was released. It brought us great additions like lambdas, streams, optionals, and many more. Here at Tasktop we do mostly Java programming and are focused on increasing our productivity every day. Since we are working with Java 8, a bunch of Eclipse templates were created that make developing with Eclipse and Java 8 more efficient. With this post I want to share some of them with you. We haved released them under the MIT License and they can be found on github. See this Eclipse guide on how to import the templates.

Lambdas

Getting lambdas typed right is hard when doing it manually. Therefore the Java 8 templates contain some helpers to create most common lambdas automatically. It includes simple lambdas, predicates, functions, consumers and suppliers. Simply type “lam” and hit CTRL-Space afterwards to see and use the templates.

Optionals

Optionals are great to eliminate nulls. It always bugs me to use Optional.of because I use the Eclipse content assist a lot. Therfore I only type “Opt” and hit auto complete. Eclipse automatically adds the code Optional<T> because Optional is typed. I always have to hit delete three times before I can use the “of” method. The Java 8 templates contain two templates for optionals as well to work around this annoying problem. Simply type “opt” and hit CTRL-Space to use these templates. They contain Optional.of as well as Option.ofNullable.

As said before, the templates are hosted on Github. We also added some templates for JUnit and Mockito ;). If you have also created some templates please share them with us. We are very curious!

Related Posts

Written by Tasktop Blogger