O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required