@Test public void shouldCreateChildWithCopyOfHashMap() { final Map<String, String> map = new HashMap<>(); map.put("A", "vA"); final Map<String, String> childValueMap = new ThreadLocalMap<String, String>().childValue(map); assertThat(childValueMap, equalTo(map)); assertThat(childValueMap, is(not(sameInstance(map)))); }
@Override protected final Map<K, V> childValue(Map<K, V> parentValue) { if (parentValue == null) { return null; } else { return new HashMap<>(parentValue); } }
ThreadLocalMap extends InheritableThreadLocal<Map<K, V>> { @Override protected final Map<K, V> childValue(Map<K, V> parentValue) { if (parentValue == null) { return null; } else { return new HashMap<>(parentValue); } } }
ThreadLocalMap extends InheritableThreadLocal<Map<K, V>> { @Override protected final Map<K, V> childValue(Map<K, V> parentValue) { if (parentValue == null) { return null; } else { return new HashMap<>(parentValue); } }  }
ThreadLocalMap extends InheritableThreadLocal<Map<K, V>> { @Override protected final Map<K, V> childValue(Map<K, V> parentValue) { if (parentValue == null) { return null; } else { return new HashMap<>(parentValue); } }   }
ThreadLocalMap extends InheritableThreadLocal<Map<K, V>> { @Override protected final Map<K, V> childValue(Map<K, V> parentValue) { if (parentValue == null) { return null; } else { return new HashMap<>(parentValue); } }    }