8266571: Sequenced Collections

Reviewed-by: alanb
This commit is contained in:
Stuart Marks 2023-04-25 15:19:08 +00:00
parent bad6aa68e4
commit 17ce0976e4
42 changed files with 7060 additions and 150 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -99,6 +99,10 @@ import java.util.function.Function;
* of the time of the call. They do <em>not</em> support mutation of the
* underlying map via the optional {@link Map.Entry#setValue setValue} method.
*
* <p>The {@link #putFirst putFirst} and {@link #putLast putLast} methods of this class
* throw {@code UnsupportedOperationException}. The encounter order of mappings is determined
* by the comparison method; therefore, explicit positioning is not supported.
*
* <p>This class is a member of the
* <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
* Java Collections Framework</a>.
@ -305,6 +309,30 @@ public class TreeMap<K,V>
return key(getLastEntry());
}
/**
* Throws {@code UnsupportedOperationException}. The encounter order induced by this
* map's comparison method determines the position of mappings, so explicit positioning
* is not supported.
*
* @throws UnsupportedOperationException always
* @since 21
*/
public V putFirst(K k, V v) {
throw new UnsupportedOperationException();
}
/**
* Throws {@code UnsupportedOperationException}. The encounter order induced by this
* map's comparison method determines the position of mappings, so explicit positioning
* is not supported.
*
* @throws UnsupportedOperationException always
* @since 21
*/
public V putLast(K k, V v) {
throw new UnsupportedOperationException();
}
/**
* Copies all of the mappings from the specified map to this map.
* These mappings replace any mappings that this map had for any