SimpleStream, a simpler way to use Java 8 Streams

When Java 8 came out last year, it finally introduced lambdas, a much-awaited language feature, and along with it, a new way to manipulate data in the form of streams. While streams make it significantly easier to perform aggregate operations on collections, common tasks still involve boilerplate code that could easily be eliminated. For example:

// Collect names into a list
people.stream().map(Person::getName).collect(Collectors.toList());

// Compute sum of salaries
employees.stream().collect(Collectors.summingInt(Employee::getSalary)));

Wouldn’t it be nicer to write something like this instead?

// Collect names into a list
stream(people).map(Person::getName).toList();

// Compute sum of salaries
stream(employees).map(Employee::getSalary).sumAsInt();

SimpleStream is a wrapper around Java 8 Streams that lets you write more concise code, like in the above example. It’s a single Java file that you can drop into your project and start using immediately.

Learn more and download on GitHub

Quick Implement plugin for Eclipse

If you use Eclipse for Java development, you’re probably familiar with the magicĀ Ctrl+1 hotkey that provides all sorts of context-sensitive suggestions. One of the actions missing from the standard Java IDE is to quickly implement an interface when the cursor is hovering over its declaration. I tend to do this quite often, so I ended up writing a plugin for it.

The Quick Implement plugin extends the Java editor and provides actions to quickly implement an interface or extend a class. These actions are triggered by the standard quick assist shortcut (Ctrl+1) while the cursor is over an interface or class declaration.

Screenshot

How to install:

Download the plugin JAR file and save it in the dropins directory under your Eclipse installation.