static Entry successor()

in orderbook-core/src/main/java/com/epam/deltix/orderbook/core/impl/collections/rbt/RBTree.java [99:117]


    static <K, V> Entry<K, V> successor(final Entry<K, V> t) {
        if (t == null) {
            return null;
        } else if (t.right != null) {
            Entry<K, V> p = t.right;
            while (p.left != null) {
                p = p.left;
            }
            return p;
        } else {
            Entry<K, V> p = t.parent;
            Entry<K, V> ch = t;
            while (p != null && ch == p.right) {
                ch = p;
                p = p.parent;
            }
            return p;
        }
    }