Showing posts with label java8. Show all posts
Showing posts with label java8. Show all posts

Saturday, May 14, 2016

JAVA 8 - My notes on Streams, Collectors, and Optionals for Data Processing in Java 8 [Course]

Pluralsight course:
Streams, Collectors, and Optionals for Data Processing in Java 8 by Jose Paumard

SPLITERATOR
Is the object on which a Stream is based.
It is a kind of iterator for a collection.
Collection access its data through Iterator, Stream - trough Spliterator.


Tuesday, May 3, 2016

JAVA 8 - what is Functional Interface and Lambda Expression, etc

Functional Interface is an interface with only one method.
- default methods do not count
- static methods do not count
- methods from the Object class do not count

A Lambda Expression is an instance of a functional interface.
public interface Predicate<T> {
    boolean test(T t);
}

Implementation would be:
Predicate<String> predicate = s -> s.length() < 20;
System.out.println(predicate.test("Hello world!"));//expicite way of using it