}
public TrieMap (final Hashing<K> hashf, final Equiv<K> ef) {
- this(INode.newRootNode(), hashf, ef, false);
+ this(newRootNode(), hashf, ef, false);
}
public TrieMap () {
// } while (obj != TrieMapSerializationEnd);
// }
+ private static <K,V> INode<K,V> newRootNode() {
+ final Gen gen = new Gen();
+ return new INode<>(gen, new CNode<>(gen));
+ }
+
final boolean CAS_ROOT (final Object ov, final Object nv) {
if (isReadOnly()) {
throw new IllegalStateException("Attempted to modify a read-only snapshot");
final public void clear () {
while (true) {
INode<K, V> r = RDCSS_READ_ROOT ();
- if (!RDCSS_ROOT (r, r.gcasRead (this), INode.<K, V>newRootNode ())) {
+ if (!RDCSS_ROOT(r, r.gcasRead(this), newRootNode())) {
continue;
}else{
return;
}
lastReturned = r;
- if(r instanceof Map.Entry) {
+ if (r != null) {
final Map.Entry<K, V> rr = r;
return nextEntry(rr);
}
private void readObject(final ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
inputStream.defaultReadObject();
- this.root = INode.newRootNode();
+ this.root = newRootNode();
final boolean ro = inputStream.readBoolean();
final int size = inputStream.readInt();