The supplier – Supplier<A> supplier();

The job of supplier() is to return (at every call) a Supplier of an empty mutable result container.

In our case, the result container is of the Map<Boolean, List<Melon>> type, and so supplier() can be implemented as follows:

@Override
public Supplier<Map<Boolean, List<Melon>>> supplier() {

return () -> {
return new HashMap<Boolean, List<Melon>> () {
{
put(true, new ArrayList<>());
put(false, new ArrayList<>());
}
};
};
}

In parallel execution, this method may be called multiple times.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset