Returns the node containing the key just before the given key.
964247
public Node<T> getNext(int value) {
    	if (value == last.value) return null;
    	if (value == root.value) {
    		if (root.right == null) return null;
    		Node<T> n = root.right;
    		while (n.left != null) n = n.left;
    		return n;
    	}
    	if (value > root.value) {
    		if (root.right == null) return null;
    		return getNext(root.right, value);
    	}
    	if (root.left == null) return null;
    	return getNext(root, root.left, value);
    }
1042967
Node<K, V> find(K key, boolean create) {
    Comparator<? super K> comparator = this.comparator;
    Node<K, V>[] table = this.table;
    int hash = secondaryHash(key.hashCode());
    int index = hash & (table.length - 1);
    Node<K, V> nearest = table[index];
    int comparison = 0;

    if (nearest != null) {
      // Micro-optimization: avoid polymorphic calls to Comparator.compare().
      @SuppressWarnings("unchecked") // Throws a ClassCastException below if there's trouble.
      Comparable<Object> comparableKey = (comparator == NATURAL_ORDER)
          ? (Comparable<Object>) key
          : null;

      while (true) {
        comparison = (comparableKey != null)
            ? comparableKey.compareTo(nearest.key)
            : comparator.compare(key, nearest.key);

        // We found the requested key.
        if (comparison == 0) {
          return nearest;
        }

        // If it exists, the key is in a subtree. Go deeper.
        Node<K, V> child = (comparison < 0) ? nearest.left : nearest.right;
        if (child == null) {
          break;
        }

        nearest = child;
      }
    }

    // The key doesn't exist in this tree.
    if (!create) {
      return null;
    }

    // Create the node and add it to the tree or the table.
    Node<K, V> header = this.header;
    Node<K, V> created;
    if (nearest == null) {
      // Check that the value is comparable if we didn't do any comparisons.
      if (comparator == NATURAL_ORDER && !(key instanceof Comparable)) {
        throw new ClassCastException(key.getClass().getName() + " is not Comparable");
      }
      created = new Node<K, V>(nearest, key, hash, header, header.prev);
      table[index] = created;
    } else {
      created = new Node<K, V>(nearest, key, hash, header, header.prev);
      if (comparison < 0) { // nearest.key is higher
        nearest.left = created;
      } else { // comparison > 0, nearest.key is lower
        nearest.right = created;
      }
      rebalance(nearest, true);
    }

    if (size++ > threshold) {
      doubleCapacity();
    }
    modCount++;

    return created;
  }
76288
public Node before(Node node) {
        Validate.notNull(node);
        Validate.notNull(parentNode);

        parentNode.addChildren(siblingIndex, node);
        return this;
    }
388298
def find(self, key, perfect=False):
        
        return find_in_tree(self.root, key, perfect)
10305
public V get(Object key) {
	checkKey(key);
	
	String cs = (String)key;
	Node<V> n = lookup(cs);
	return (n == null) ? null : n.value;
    }
864902
public function getNodeByKey($key): ?Node {
        $arrayIndex = $this->getBucketIndex($key);
        /*
         * the list is requested from the array based on
         * the array index hash.
         */
        /** @var SinglyLinkedList $list */
        if (!isset($this->bucket[$arrayIndex])) {
            return null;
        }
        $list = $this->bucket[$arrayIndex];
        if (!$list->containsKey($key)) {
            return null;
        }
        $node = $list->getNodeByKey($key);
        return $node;
    }
885638
def extract_hash_pair(node, key)
      node.children.detect do |child|
        next unless child.type == :pair
        key_node = child.children[0]
        %i[sym str].include?(key_node.type) && key_node.children[0].to_s == key
      end
    end
132966
def node_before(node)
      node.parent.equal? self or
        raise ArgumentError, "node is not a child"
      fields = self.fields
      i = node.instance_variable_get(:@parent_field).index - 1
      i.downto(0) do |i|
        f = fields[i]
        if f.child? && (val = self.send(f.reader))
          return val
        end
      end
      return nil
    end
1148694
public <T> T getNodeMetaData(Object key) {
        if (metaDataMap == null) {
            return (T) null;
        }
        return (T) metaDataMap.get(key);
    }
1129730
Node<K, V> find(K key, boolean create) {
    Comparator<? super K> comparator = this.comparator;
    Node<K, V> nearest = root;
    int comparison = 0;

    if (nearest != null) {
      // Micro-optimization: avoid polymorphic calls to Comparator.compare().
      @SuppressWarnings("unchecked") // Throws a ClassCastException below if there's trouble.
          Comparable<Object> comparableKey = (comparator == NATURAL_ORDER)
          ? (Comparable<Object>) key
          : null;

      while (true) {
        comparison = (comparableKey != null)
            ? comparableKey.compareTo(nearest.key)
            : comparator.compare(key, nearest.key);

        // We found the requested key.
        if (comparison == 0) {
          return nearest;
        }

        // If it exists, the key is in a subtree. Go deeper.
        Node<K, V> child = (comparison < 0) ? nearest.left : nearest.right;
        if (child == null) {
          break;
        }

        nearest = child;
      }
    }

    // The key doesn't exist in this tree.
    if (!create) {
      return null;
    }

    // Create the node and add it to the tree or the table.
    Node<K, V> header = this.header;
    Node<K, V> created;
    if (nearest == null) {
      // Check that the value is comparable if we didn't do any comparisons.
      if (comparator == NATURAL_ORDER && !(key instanceof Comparable)) {
        throw new ClassCastException(key.getClass().getName() + " is not Comparable");
      }
      created = new Node<K, V>(nearest, key, header, header.prev);
      root = created;
    } else {
      created = new Node<K, V>(nearest, key, header, header.prev);
      if (comparison < 0) { // nearest.key is higher
        nearest.left = created;
      } else { // comparison > 0, nearest.key is lower
        nearest.right = created;
      }
      rebalance(nearest, true);
    }
    size++;
    modCount++;

    return created;
  }
1080256
def get(key)
      node = self

      while node do
        # Find index of the entry that best fits the key.
        i = node.search_key_index(key)
        if node.is_leaf
          # This is a leaf node. Check if there is an exact match for the
          # given key and return the corresponding value or nil.
          return node.keys[i] == key ? node.values[i] : nil
        end

        # Descend into the right child node to continue the search.
        node = node.children[i]
      end

      PEROBS.log.fatal "Could not find proper node to get from while " +
        "looking for key #{key}"
    end
1128542
def find_node(key)
      return nil if @root == nil
      node = @root.find_vertical(key)
      (node.nil? || node.value.nil? ? nil : node)
    end
154983
final Node<E> pred(Node<E> p) {
        Node<E> q = p.prev;
        // j2objc: q == p.prev == sentinel means node GC-unlinked
        return (sentinel() == q) ? last() : q;
    }
833527
public V get(long key) {
		if (size == 0) {
			return null;
		}
		if (size == 1) {
			int posDiff = compare(key, rootKey);
			if (posDiff == -1) {
				return rootVal;
			}
			return null;
		}
		Node<V> n = root;
		while (true) {
			if (!doesInfixMatch(n, key)) {
				return null;
			}			
			
			//infix matches, so now we check sub-nodes and postfixes
			if (getBit(key, n.posDiff)) {
				if (n.hi != null) {
					n = n.hi;
					continue;
				} 
				if (compare(key, n.hiPost) == -1) {
					return n.hiVal;
				}
			} else {
				if (n.lo != null) {
					n = n.lo;
					continue;
				}
				if (compare(key, n.loPost) == -1) {
					return n.loVal;
				}
			}
			return null;
		}
	}
49468
public Integer getNodesPartitionIdForKey(int nodeId, final byte[] key) {
        // this is all the partitions the key replicates to.
        List<Integer> partitionIds = getReplicatingPartitionList(key);
        for(Integer partitionId: partitionIds) {
            // check which of the replicating partitions belongs to the node in
            // question
            if(getNodeIdForPartitionId(partitionId) == nodeId) {
                return partitionId;
            }
        }
        return null;
    }
329133
public List<ITopicNode> getTopicNodesForKey(final String key) {
        if (topicsKeys.containsKey(key)) {
            return topicsKeys.get(key);
        }

        return new LinkedList<ITopicNode>();
    }
655037
private int findIndexByKey(Object key)
    {
        // Traverse the vector from the back. Given proper locking done at
        // a higher level, this will ensure that the cache gets to the same
        // element in the presence of duplicates.
        // Traversing the vector from the first element causes a problem since
        // elements are inserted at the end of the vector (for efficiency).
        // Consequently after inserting duplicate element 1.2, if another
        // operation is performed on the same key 1, we will get to 1.1 instead
        // of 1.2
        for (int i = (size() - 1); i >= 0; --i) {
            Element element = (Element) get(i);
            if (element.key.equals(key)) {
                return i;
            }
        }

        return -1;
    }