RFR 15 8242327: List spec should state that unmodifiable lists implement RandomAccess
Stuart Marks
stuart.marks at oracle.com
Fri Apr 10 02:52:57 UTC 2020
Thanks Lance.
Upon advice from Pavel Rappo, I've adjusted the link markup to use the full
reference form of a javadoc link. Revised patch below. Also, could you review
the CSR?
https://bugs.openjdk.java.net/browse/JDK-8242406
Thanks,
s'marks
# HG changeset patch
# User smarks
# Date 1586486847 25200
# Thu Apr 09 19:47:27 2020 -0700
# Node ID 45a22ec2df1a3738d241d82c375507bf4aeb3d1b
# Parent 46108b5b69d92dd424b73b828454849c397509cb
8242327: List spec should state that unmodifiable lists implement RandomAccess
Reviewed-by: XXX
diff -r 46108b5b69d9 -r 45a22ec2df1a src/java.base/share/classes/java/util/List.java
--- a/src/java.base/share/classes/java/util/List.java Tue Apr 07 16:31:46 2020 -0700
+++ b/src/java.base/share/classes/java/util/List.java Thu Apr 09 19:47:27 2020 -0700
@@ -104,6 +104,8 @@
* <li>They are serializable if all elements are serializable.
* <li>The order of elements in the list is the same as the order of the
* provided arguments, or of the elements in the provided array.
+ * <li>The lists and their {@link #subList(int, int) subList} views implement the
+ * {@link RandomAccess} interface.
* <li>They are <a href="../lang/doc-files/ValueBased.html">value-based</a>.
* Callers should make no assumptions about the identity of the returned
instances.
* Factories are free to create new instances or reuse existing ones. Therefore,
On 4/8/20 2:33 PM, Lance Andersen wrote:
> Hi Stuart,
>
> This looks good
>
>> On Apr 8, 2020, at 5:01 PM, Stuart Marks <stuart.marks at oracle.com
>> <mailto:stuart.marks at oracle.com>> wrote:
>>
>> Hi all,
>>
>> Please review this small change to the List interface that specifies that
>> unmodifiable lists (returned by List.of et al) implement the RandomAccess
>> marker interface. In fact, they already do; the intent of this section was to
>> specify the user-visible characteristics of such lists, but this particular
>> characteristic was accidentally omitted.
>>
>> https://bugs.openjdk.java.net/browse/JDK-8242327
>>
>> Patch below. I'll follow up with a CSR request.
>>
>> Thanks,
>>
>> s'marks
More information about the core-libs-dev
mailing list