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 Contact:
        public class Contact {
  1. Declare two private String attributes named name and phone:
        private final String name;         private final String phone;
  1. Implement the constructor of the class to initialize its attributes:
        public Contact(String name, String phone) {           this.name=name;           this.phone=phone;         }
  1. Implement the methods to return the values of the name and phone attributes:
        public String getName() {           return name;         }          public String getPhone() {           return phone;         }
  1. Create a class named Task and specify that it implements the Runnable interface:
        public class Task implements Runnable {
  1. Declare a private ConcurrentSkipListMap attribute, parameterized ...

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