I'm using putIfAbsent to add values to a ConcurrentHashMap if they do not already exist as an atomic operations.
That all seems fine, but I could really do with being able to tell whether a new object was actually added.
The best idea I have is to check if the return value from putIfAbsent is null, that looks like it should work so long as we never put null values into the map (which ConcurrentHashMap doesn't allow anyway) but I was wondering if there was something I missed. Or is that the correct way to do it?