if (collection.isEmpty()) {
map.remove(key);
} else {
if (type.equals(P6Factory.class)) {
// for P6Factories the hashcode is computed based on class
newValue = new CustomHashedHashSet<T>(new ClassHasher());
} else {
newValue = new HashSet<T>();
}
for (String item : collection) {