Fight the Future


Introduction to Javaslang

I translated this article into Japanese in InfoQ.

I haven't known Javaslang library for now.

What is Javaslang?

Javaslang's website is below:

Javaslang brings functional programming to Java.

This library is inspired by Scala. It mainly focuses on Collection library.

How to use?

It needs Java 8 and is available in Maven Central repository.

I try to use Javaslang version 2.0.5.

Differ from Java 8, Javaslang has its own List and Stream interface.

Number sum = List.of(1, 2, 3).sum();
System.out.println(sum); // 6

And it has Option which correspond to Java 8's Optional, Tuple, Pattern Matching and so on.

For more infomation, visit Javaslang website.