package org.xbib.datastructures.immutable;

class NonTerminalImmutableMapEntry<K, V> extends ImmutableMapEntry<K, V> {
    /*
     * Yes, we sometimes set nextInKeyBucket to null, even for this "non-terminal" entry. We don't
     * do that with a plain NonTerminalImmutableMapEntry, but we do it with the BiMap-specific
     * subclass below. That's because the Entry might be non-terminal in the key bucket but terminal
     * in the value bucket (or vice versa).
     */
    private final transient ImmutableMapEntry<K, V> nextInKeyBucket;

    NonTerminalImmutableMapEntry(K key, V value, ImmutableMapEntry<K, V> nextInKeyBucket) {
        super(key, value);
        this.nextInKeyBucket = nextInKeyBucket;
    }

    @Override
    final ImmutableMapEntry<K, V> getNextInKeyBucket() {
        return nextInKeyBucket;
    }

    @Override
    final boolean isReusable() {
        return false;
    }
}
