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

View File

@ -888,8 +888,14 @@ public interface List<E> extends SequencedCollection<E> {
* {@inheritDoc}
*
* @implSpec
* The implementation in this interface returns an instance of a reverse-ordered
* List that delegates its operations to this List.
* The implementation in this interface returns a reverse-ordered List
* view. The {@code reversed()} method of the view returns a reference
* to this List. Other operations on the view are implemented via calls to
* public methods on this List. The exact relationship between calls on the
* view and calls on this List 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 List.
*
* @return a reverse-ordered view of this collection, as a {@code List}
* @since 21

View File

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

View File

@ -360,8 +360,14 @@ public interface SortedSet<E> extends Set<E>, SequencedSet<E> {
* {@inheritDoc}
*
* @implSpec
* The implementation in this interface returns an instance of a reverse-ordered
* SortedSet that delegates its operations to this SortedSet.
* The implementation in this interface returns a reverse-ordered SortedSet
* view. The {@code reversed()} method of the view returns a reference
* to this SortedSet. Other operations on the view are implemented via calls to
* public methods on this SortedSet. The exact relationship between calls on the
* view and calls on this SortedSet 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 SortedSet.
*
* @return a reverse-ordered view of this collection, as a {@code SortedSet}
* @since 21