a
package com.codegym.task.task26.task2611;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/*
The world doesn't change, we change
*/
public class Solution {
public static void main(String[] args) throws Exception {
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
Producer producer = new Producer(map);
Consumer consumer = new Consumer(map);
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.submit(producer);
executorService.submit(consumer);
Thread.sleep(2000);
executorService.shutdownNow();
// Finally, 5 lines have to be printed
}
}