+ private static VerifyException invalidElement(final BasicNode elem) {
+ throw new VerifyException("An INode can host only a CNode, a TNode or an LNode, not " + elem);
+ }
+
+ @SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
+ justification = "Returning null Optional indicates the need to restart.")
+ private Optional<V> insertDual(final TrieMap<K, V> ct, final CNode<K, V> cn, final int pos, final SNode<K, V> sn,
+ final K k, final V v, final int hc, final int lev) {
+ final CNode<K, V> rn = (cn.gen == gen) ? cn : cn.renewed(gen, ct);
+ final MainNode<K, V> nn = rn.updatedAt(pos, inode(CNode.dual(sn, k, v, hc, lev + LEVEL_BITS, gen)), gen);
+ return GCAS(cn, nn, ct) ? Optional.empty() : null;
+ }
+