How to do it...

Follow these steps to implement the example:

  1. Create a class named Person. This class will have six attributes to define some basic characteristics of a person. We will implement the methods to get() and set() the values of the attributes, but they won't be included here:
        public class Person {           private int id;           private String firstName;           private String lastName;           private Date birthDate;           private int salary;           private double coeficient;
  1. Now, implement a class named PersonGenerator. This class will only have a method named generatedPersonList() to generate a list of Person objects with random values with the size specified in parameters. This is the source code of this class:
        public class PersonGenerator {  public static ...

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.