How to do it...

Follow these steps to implement the example:

  1. Create a class named Item to store the information of each element of the matrix. It will have three private attributes: a String attribute named name and two integer attributes named row and column. Create the methods to get and set the values of these attributes. The code of this class is very simple, so it won't be included here.
  2. Create a class named MySpliterator. Specify that it implements the Spliterator interface parameterized by the Item class. This class has four attributes: a matrix of Item objects named items and three integer attributes named start, end, and current to store the first and last elements that will be processed by this Spliterator interface and the current ...

Get Java 9 Concurrency Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.