Skip to content

Commit f82c818

Browse files
author
Stuart Marks
committed
8308694: Clarify reversed() default methods' implementation requirements
Reviewed-by: rriggs
1 parent 7304316 commit f82c818

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

src/java.base/share/classes/java/util/Deque.java

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

src/java.base/share/classes/java/util/List.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -888,8 +888,14 @@ default E removeLast() {
888888
* {@inheritDoc}
889889
*
890890
* @implSpec
891-
* The implementation in this interface returns an instance of a reverse-ordered
892-
* List that delegates its operations to this List.
891+
* The implementation in this interface returns a reverse-ordered List
892+
* view. The {@code reversed()} method of the view returns a reference
893+
* to this List. Other operations on the view are implemented via calls to
894+
* public methods on this List. The exact relationship between calls on the
895+
* view and calls on this List is unspecified. However, order-sensitive
896+
* operations generally delegate to the appropriate method with the opposite
897+
* orientation. For example, calling {@code getFirst} on the view results in
898+
* a call to {@code getLast} on this List.
893899
*
894900
* @return a reverse-ordered view of this collection, as a {@code List}
895901
* @since 21

src/java.base/share/classes/java/util/SortedMap.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,14 @@ default V putLast(K k, V v) {
316316
* {@inheritDoc}
317317
*
318318
* @implSpec
319-
* The implementation in this interface returns an instance of a reverse-ordered
320-
* SortedMap that delegates its operations to this SortedMap.
319+
* The implementation in this interface returns a reverse-ordered SortedMap
320+
* view. The {@code reversed()} method of the view returns a reference
321+
* to this SortedMap. Other operations on the view are implemented via calls to
322+
* public methods on this SortedMap. The exact relationship between calls on the
323+
* view and calls on this SortedMap is unspecified. However, order-sensitive
324+
* operations generally delegate to the appropriate method with the opposite
325+
* orientation. For example, calling {@code firstEntry} on the view results in
326+
* a call to {@code lastEntry} on this SortedMap.
321327
*
322328
* @return a reverse-ordered view of this map, as a {@code SortedMap}
323329
* @since 21

src/java.base/share/classes/java/util/SortedSet.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,14 @@ default E removeLast() {
360360
* {@inheritDoc}
361361
*
362362
* @implSpec
363-
* The implementation in this interface returns an instance of a reverse-ordered
364-
* SortedSet that delegates its operations to this SortedSet.
363+
* The implementation in this interface returns a reverse-ordered SortedSet
364+
* view. The {@code reversed()} method of the view returns a reference
365+
* to this SortedSet. Other operations on the view are implemented via calls to
366+
* public methods on this SortedSet. The exact relationship between calls on the
367+
* view and calls on this SortedSet is unspecified. However, order-sensitive
368+
* operations generally delegate to the appropriate method with the opposite
369+
* orientation. For example, calling {@code getFirst} on the view results in
370+
* a call to {@code getLast} on this SortedSet.
365371
*
366372
* @return a reverse-ordered view of this collection, as a {@code SortedSet}
367373
* @since 21

0 commit comments

Comments
 (0)