mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8226831: Use Objects.equals() when appropriate
Reviewed-by: rriggs, bpb
This commit is contained in:
parent
99bf89c581
commit
3ed845784d
7 changed files with 26 additions and 31 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, 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
|
||||
|
@ -302,9 +302,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
|||
m instanceof TreeMap) {
|
||||
SortedSet<? extends E> set = (SortedSet<? extends E>) c;
|
||||
TreeMap<E,Object> map = (TreeMap<E, Object>) m;
|
||||
Comparator<?> cc = set.comparator();
|
||||
Comparator<? super E> mc = map.comparator();
|
||||
if (cc==mc || (cc != null && cc.equals(mc))) {
|
||||
if (Objects.equals(set.comparator(), map.comparator())) {
|
||||
map.addAllForTreeSet(set, PRESENT);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue