code
docs
tests
The Zest™ Core Functional API is a generic package to work with Iterables in a "functional programming language" style.
This package is completely independent of everything else in Zest™ and may be used on its own in any kind of environment such as Spring or Java EE applications.
Let’s say that you have an Iterable of Integers and you want to sum them all up. Most people would create a loop and sum it all up in something like this;
Iterable<Long> data = new ArrayList<Long>(); [...snip...] long sum = 0; for( Long point : data ) { sum = sum + point; } System.out.println( "The sum is " + sum );
With the Zest™ Core Functional API, you go about it in a different way. The code ends up looking like this;
Iterable<Long> data = new ArrayList<>(); Long total = StreamSupport.stream( data.spliterator(), true ).reduce( 0L, ( sum, n ) -> sum + n ); System.out.println( "The sum is " + total );
And this is just the tip of the iceberg.
The Zest™ Core Functional API are divided a handful of powerful concepts, especially when used together;