ExecutorService executorService = Executors.newFixedThreadPool(10);
for (int i = 0; i < 100; i++) {
Runnable task = new MyTask();
executorService.submit(task);
}
executorService.shutdown();
ConcurrentMap<String, Integer> concurrentMap = new ConcurrentHashMap<>();
concurrentMap.put("key1", 1);
concurrentMap.put("key2", 2);
Integer value = concurrentMap.get("key1");
System.out.println(value);
AtomicInteger atomicInteger = new AtomicInteger(0);
atomicInteger.incrementAndGet();
System.out.println(atomicInteger.get());