8308694: Clarify reversed() default methods' implementation requirements

Reviewed-by: rriggs
This commit is contained in:
Stuart Marks 2023-07-12 16:10:41 +00:00
parent 7304316a8c
commit f82c8184b2
4 changed files with 32 additions and 8 deletions

View file

@ -617,8 +617,14 @@ public interface Deque<E> extends Queue<E>, SequencedCollection<E> {
* {@inheritDoc}
*
* @implSpec
* The implementation in this interface returns an instance of a reverse-ordered
* Deque that delegates its operations to this Deque.
* The implementation in this interface returns a reverse-ordered Deque
* view. The {@code reversed()} method of the view returns a reference
* to this Deque. Other operations on the view are implemented via calls to
* public methods on this Deque. The exact relationship between calls on the
* view and calls on this Deque is unspecified. However, order-sensitive
* operations generally delegate to the appropriate method with the opposite
* orientation. For example, calling {@code getFirst} on the view results in
* a call to {@code getLast} on this Deque.
*
* @return a reverse-ordered view of this collection, as a {@code Deque}
* @since 21