given the following code?
final Map<String, List<E>> map = new HashMap<String, List<E>>(); List<E> list = map.get(mapKey); if (list == null) { list = new ArrayList<E>(); map.put(mapKey, list); } list.add(value);
If I can avoid a null check? But let Map automatically create a list for my first insertion?
I remember that once I saw a specialized card capable of doing this. However, I forgot where I already saw :(
source share