<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I could create a PR for this if wanted.</p>
<p>I would suggest changing</p>
<p>> The size, isEmpty, get, set, iterator, and listIterator
operations run in constant time. The add operation runs in
amortized constant time, that is, adding n elements requires O(n)
time. All of the other operations run in linear time (roughly
speaking). The constant factor is low compared to that for the
LinkedList implementation.</p>
<p>to</p>
<p>> The size, isEmpty, get, set, iterator, listIterator, and
reversed operations run in constant time. The add, addLast, and
removeLast operations runs in amortized constant time, that is,
adding n elements requires O(n) time. All of the other operations
run in linear time (roughly speaking). The constant factor is low
compared to that for the LinkedList implementation.</p>
<p><br>
</p>
<p>Is there any other part of the documentation that should be
changed?</p>
<p>Note that I do not have an OpenJDK account as I haven't
contributed to OpenJDK projects before (Though I did sign the
OCA).<br>
</p>
<p>Yours,<br>
Daniel</p>
<p></p>
<div class="moz-cite-prefix">Am 20.07.2023 um 17:04 schrieb Daniel
Schmid:<br>
</div>
<blockquote type="cite"
cite="mid:f0a75163-31b1-ef79-32a3-f57dfca04737@wwwmaster.at">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>I could create a PR for this if wanted.</p>
<p>I would suggest changing</p>
<p>> The size, isEmpty, get, set, iterator, and listIterator
operations run in constant time. The add operation runs in
amortized constant time, that is, adding n elements requires
O(n) time. All of the other operations run in linear time
(roughly speaking). The constant factor is low compared to that
for the LinkedList implementation.</p>
<p>to</p>
<p>> The size, isEmpty, get, set, iterator, listIterator, and
reversed operations run in constant time. The add, addLast, and
removeLast operations runs in amortized constant time, that is,
adding n elements requires O(n) time. All of the other
operations run in linear time (roughly speaking). The constant
factor is low compared to that for the LinkedList
implementation.</p>
<p><br>
</p>
<p>Is there any other <br>
</p>
---
<pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Hi Daniel,
Core-libs-dev is indeed the correct alias for this documentation issue.
Create an issue to track: JDK-8311517
<<a href="https://bugs.openjdk.org/browse/JDK-8311517" class="moz-txt-link-freetext" moz-do-not-send="true">https://bugs.openjdk.org/browse/JDK-8311517</a>>
Regards, Roger
On 7/1/23 3:35 PM, Daniel Schmid wrote:
The JEP for sequenced collection (<a href="https://openjdk.org/jeps/431" class="moz-txt-link-freetext" moz-do-not-send="true">https://openjdk.org/jeps/431</a>) would
add addFirst(), removeFirst() and reversed() methods to lists.
However, the Javadoc of List mentions:
> The size, isEmpty, get, set, iterator, and listIterator operations
run in constant time. The add operation runs in amortized constant time,
that is, adding n elements requires O(n) time. All of the other
operations run in linear time (roughly speaking). The constant factor is
low compared to that for the LinkedList implementation.
This is (at the time of writing) still the case for the jdk21-fork
(<a href="https://github.com/openjdk/jdk21/blob/430ffe7ae691d097de2818391531522f2538431d/src/java.base/share/classes/java/util/ArrayList.java#L42-L47" class="moz-txt-link-freetext" moz-do-not-send="true">https://github.com/openjdk/jdk21/blob/430ffe7ae691d097de2818391531522f2538431d/src/java.base/share/classes/java/util/ArrayList.java#L42-L47</a>).
I think this should be updated to include that reversed() runs in
constant time while addFirst() and removeFirst() run in linear time.
I originally posted this in the core-libs-dev mailing list
(<a href="https://mail.openjdk.org/pipermail/core-libs-dev/2023-June/107328.html" class="moz-txt-link-freetext" moz-do-not-send="true">https://mail.openjdk.org/pipermail/core-libs-dev/2023-June/107328.html</a>)
but it seems like that mail has been overlooked due to the amount of
other content with PRs etc. there.
Yours,
Daniel</pre>
<p> </p>
</blockquote>
</body>
</html>