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

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