package speiger.src.collections.PACKAGE.collections; #if !TYPE_OBJECT import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; /** * A Type-Specific {@link ObjectBidirectionalIterator} to reduce (un)boxing */ public interface BI_ITERATOR KEY_GENERIC_TYPE extends ITERATOR KEY_GENERIC_TYPE, ObjectBidirectionalIterator #else /** * This is a basically a {@link ListIterator} without the index functions. * Allowing to have a simple Bidirectional Iterator without having to keep track of the Iteration index. */ public interface BI_ITERATOR KEY_GENERIC_TYPE extends ITERATOR KEY_GENERIC_TYPE #endif { /** * Returns true if the Iterator has a Previous element * @return true if the Iterator has a Previouse element */ public boolean hasPrevious(); /** * Returns the Previous element of the iterator. * @return the Previous element of the iterator. * @throws NoSuchElementException if the iteration has no more elements */ public KEY_TYPE PREVIOUS(); #if !TYPE_OBJECT /** {@inheritDoc} *

This default implementation delegates to the corresponding type-specific function. * @deprecated Please use the corresponding type-specific function instead. */ @Override @Deprecated public default CLASS_TYPE previous() { return KEY_TO_OBJ(PREVIOUS()); } /** * {@inheritDoc} */ @Override default int skip(int amount) { return ITERATOR.super.skip(amount); } #endif /** * Reverses the Given amount of elements if possible. A Optimization function to reverse elements faster if the implementation allows it. * @param amount the amount of elements that should be reversed * @return the amount of elements that were reversed */ public default int back(int amount) { if(amount < 0) throw new IllegalStateException("Can't go forward"); int i = 0; for(;i