An implementation for Set#equals(Object).
(Set<?> s, @Nullable Object object)
| 1455 | |
| 1456 | |
| 1457 | static boolean equalsImpl(Set<?> s, @Nullable Object object) { |
| 1458 | if (s == object) { |
| 1459 | return true; |
| 1460 | } |
| 1461 | if (object instanceof Set) { |
| 1462 | Set<?> o = (Set<?>) object; |
| 1463 | try { |
| 1464 | return s.size() == o.size() && s.containsAll(o); |
| 1465 | } catch (NullPointerException ignored) { |
| 1466 | return false; |
| 1467 | } catch (ClassCastException ignored) { |
| 1468 | return false; |
| 1469 | } |
| 1470 | } |
| 1471 | return false; |
| 1472 | } |
| 1473 | |
| 1474 | /** |
| 1475 | * Returns an unmodifiable view of the specified navigable set. This method |