On Fri, 21 Apr 2023 22:33:13 GMT, Stuart Marks <sma...@openjdk.org> wrote:
>> PR for Sequenced Collections implementation. > > Stuart Marks has updated the pull request incrementally with two additional > commits since the last revision: > > - Wording tweaks to SequencedMap / NavigableMap. > - Change "The implementation in this class" to "... interface." src/java.base/share/classes/java/util/AbstractMap.java line 900: > 898: */ > 899: /* non-public */ abstract static class ViewCollection<E> implements > Collection<E> { > 900: UnsupportedOperationException uoe() { return new > UnsupportedOperationException(); } This doesn’t need to be an instance method: Suggestion: static UnsupportedOperationException uoe() { return new UnsupportedOperationException(); } src/java.base/share/classes/java/util/SortedMap.java line 113: > 111: */ > 112: > 113: public interface SortedMap<K,V> extends SequencedMap<K,V> { This interface can now provide default implementations for the `firstKey` and `lastKey` methods: default K firstKey() { var entry = this.firstEntry(); if (entry == null) { throw new NoSuchElementException(); } return entry.getKey(); } default K lastKey() { var entry = this.lastEntry(); if (entry == null) { throw new NoSuchElementException(); } return entry.getKey(); } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1174349716 PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1174351159