ValueContainerImpl<Value> () { try { //noinspection unchecked ValueContainerImpl<Value> clone = (ValueContainerImpl<Value>)super.clone(); ValueToInputMap<Value> mapping = asMapping(); if (mapping != null) { ValueToInputMap<Value> cloned = mapping.clone(); cloned.forEach((key, val) -> { if (val instanceof ChangeBufferingList) { cloned.put(key, ((ChangeBufferingList)val).clone()); } }); clone.myInputIdMapping = cloned; } else if (myInputIdMappingValue instanceof ChangeBufferingList) { clone.myInputIdMappingValue = ((ChangeBufferingList)myInputIdMappingValue).clone(); } clone.myPresentInputIds = myPresentInputIds != null ? new Int2ObjectOpenHashMap<>(myPresentInputIds) : null; clone.myUpdateOps = myUpdateOps != null ? new SmartList<>(myUpdateOps) : null; return clone; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } }