Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Java 8 Eclipse Templates

DZone's Guide to

Java 8 Eclipse Templates

Become more efficient with these new Java 8 Eclipse templates by Tasktop.

· Java Zone
Free Resource

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

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!

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.

Topics:
eclipse ,java 8 ,productivity ,shortcuts

Published at DZone with permission of David Shepherd, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}