[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 8266571: Sequenced Collections [v3]
From:       Stuart Marks <smarks () openjdk ! org>
Date:       2023-03-28 1:31:45
Message-ID: Up2YjCsx6LbIR-APwjrCykNSeSk89mwhL45PRsN3fO8=.bd1cef22-13d0-4f0f-892f-60821b3642ef () github ! com
[Download RAW message or body]

On Fri, 24 Mar 2023 21:35:22 GMT, Tagir F. Valeev <tvaleev@openjdk.org> wrote:

> > Stuart Marks has updated the pull request with a new target base due to a merge \
> > or a rebase. The pull request now contains 78 commits: 
> > - Merge branch 'master' into JDK-8266571-SequencedCollections
> > - Update copyrights.
> > - More specification tweaks.
> > - Add simple overrides to ArrayList.
> > - Specification cleanups.
> > - Update spec of CopyOnWriteArrayList::reversed.
> > - Move AbstractViewCollection to AbstractMap.ViewCollection to avoid exposing it \
> >                 publicly.
> > - Merge branch 'master' into JDK-8266571-SequencedCollections
> > Resolve conflict by deleting IdentityLinkedList.java
> > - Merge branch 'master' into JDK-8266571-SequencedCollections
> > - Fix indentation.
> > - ... and 68 more: https://git.openjdk.org/jdk/compare/6aec6f3a...91c4eabe
> 
> src/java.base/share/classes/java/util/LinkedHashMap.java line 1123:
> 
> > 1121: 
> > 1122:         public V put(K key, V value) {
> > 1123:             return base.put(key, value);
> 
> Why `put()` simply delegates to `base.put()` while `putAll()` below does more \
> complex containsKey-put-putFirst procedure? I think that `putAll()` should be \
> equivalent to `for(var e : m.entrySet()) put(e.getKey(), e.getValue());`. Am I \
> missing something?

I think you're right, you're not missing anything. The entry that is put() should \
always go at the end of this view, and since this is the reversed view, it should go \
at the front of the base map. And putAll() should follow.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1149933611


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic