mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8267110: Update java.util to use instanceof pattern variable
Reviewed-by: lancea, naoto
This commit is contained in:
parent
0a03fc84b3
commit
a52c4ede2f
29 changed files with 142 additions and 266 deletions
|
@ -299,9 +299,8 @@ public class TreeSet<E> extends AbstractSet<E>
|
|||
// Use linear-time version if applicable
|
||||
if (m.size()==0 && c.size() > 0 &&
|
||||
c instanceof SortedSet &&
|
||||
m instanceof TreeMap) {
|
||||
m instanceof TreeMap<E, Object> map) {
|
||||
SortedSet<? extends E> set = (SortedSet<? extends E>) c;
|
||||
TreeMap<E,Object> map = (TreeMap<E, Object>) m;
|
||||
if (Objects.equals(set.comparator(), map.comparator())) {
|
||||
map.addAllForTreeSet(set, PRESENT);
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue