class TailConcatSpliterator<T> implements TailSpliterator<T> {
    private Spliterator<T> left, right;
    private int characteristics;
    private long size;

    @SuppressWarnings("unchecked")
    public TailConcatSpliterator(Spliterator<? extends T> left, Spliterator<? extends T> right) {
        this.left = (Spliterator<T>) left;
        this.right = (Spliterator<T>) right;
        this.characteristics = left.characteristics() & right.characteristics() & (ORDERED | SIZED | SUBSIZED);
        this.size = left.estimateSize() + right.estimateSize();
        if (this.size < 0) {
            this.size = Long.MAX_VALUE;
            this.characteristics &= (~SIZED) & (~SUBSIZED);
        }
    }

    @Override
    public boolean tryAdvance(Consumer<? super T> action) {<FILL_FUNCTION_BODY>}

    @Override
    public Spliterator<T> tryAdvanceOrTail(Consumer<? super T> action) {
        if (left == null || !left.tryAdvance(action)) {
            Spliterator<T> s = right;
            right = null;
            return s;
        }
        if (size > 0 && size != Long.MAX_VALUE)
            size--;
        return this;
    }

    @Override
    public void forEachRemaining(Consumer<? super T> action) {
        if (left != null)
            left.forEachRemaining(action);
        if (right != null)
            TailSpliterator.forEachWithTail(right, action);
    }

    @Override
    public Spliterator<T> forEachOrTail(Consumer<? super T> action) {
        if (left != null)
            left.forEachRemaining(action);
        Spliterator<T> s = right;
        right = null;
        return s;
    }

    @Override
    public Spliterator<T> trySplit() {
        if (left == null)
            return right.trySplit();
        Spliterator<T> s = left;
        left = null;
        return s;
    }

    @Override
    public long estimateSize() {
        if (left == null)
            return right == null ? 0 : right.estimateSize();
        return size;
    }

    @Override
    public int characteristics() {
        return characteristics;
    }
}

        if (left != null) {
            if (left.tryAdvance(action)) {
                if (size > 0 && size != Long.MAX_VALUE)
                    size--;
                return true;
            }
            left = null;
        }
        if (right != null)
            right = TailSpliterator.tryAdvanceWithTail(right, action);
        return right != null;
    
<no_super_class>