if (node == null) { //If the index is currently empty
locator.delete(this);
return new ArrayNode(count+1, cloneAndSet(array, index, (String) (BitmapIndexedNode.EMPTY.put(shift+5, hash, key, value, addedLeaf)).getId()));
}
//Else add it later on in the tree
final DistributedImmutableHashMap newNode = ((DistributedImmutableHashMap) locator.open(node, "r")).put(shift+5, hash, key, value, addedLeaf);
if (newNode == null) {
return this;
}
locator.delete(this);
return new ArrayNode(count, cloneAndSet(array, index, (String) newNode.getId()));