Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8308694

Clarify reversed() default methods' implementation requirements

    XMLWordPrintable

Details

    Backports

      Description

        https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/util/Deque.html#reversed()
        "Implementation Requirements:
        The implementation in this interface returns an instance of a reverse-ordered Deque that delegates its operations to this Deque."

        The phrase - "delegates its operations to this Deque." one might interpret this the delegation is 'x' to 'x' ( reversedeque.addFirst() ---> deque.addFirst() )
        Actual delegation is -> reversedeque.addFirst() ---> deque.addLast()

        ====
        Similar case for - https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/util/SortedMap.html#reversed()

        Similar case for - https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/util/SortedSet.html#reversed()

        Do we need to clarify the spec here?

        Attachments

          Issue Links

            Activity

              People

                smarks Stuart Marks
                kganapureddy Krushnareddy Ganapureddy
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: