ThreadLocal allows you to create variables that can only be read and written by the same thread, thus avoiding synchronization.
Source Code
ThreadLocal threadLocalCount = ThreadLocal.withInitial(() -> 1);
System.out.println(threadLocalCount.get()); // Outputs 1
threadLocalCount.set(2);
System.out.println(threadLocalCount.get()); // Outputs 2