diff options
| author | Patrick Concannon <pconcannon@openjdk.org> | 2021-03-09 11:09:06 +0000 |
|---|---|---|
| committer | Patrick Concannon <pconcannon@openjdk.org> | 2021-03-09 11:09:06 +0000 |
| commit | 0f2402d0a279a4647be312977def182c4fcf5852 (patch) | |
| tree | 95a0ef4cd1397b29662cede7ab163fa6f8ed3459 /src/java.base/share/classes/java/text/AttributedString.java | |
| parent | 4f0a12ec87a3a37071a575ff992a80c2d06f5051 (diff) | |
| download | openjdk-0f2402d0a279a4647be312977def182c4fcf5852.tar.gz openjdk-0f2402d0a279a4647be312977def182c4fcf5852.zip | |
8263190: Update java.io, java.math, and java.text to use instanceof pattern variable
Reviewed-by: lancea, bpb, darcy, naoto, iris, dfuchs, smarks, redestad
Diffstat (limited to 'src/java.base/share/classes/java/text/AttributedString.java')
| -rw-r--r-- | src/java.base/share/classes/java/text/AttributedString.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/java.base/share/classes/java/text/AttributedString.java b/src/java.base/share/classes/java/text/AttributedString.java index e0765809179..16e9a28671e 100644 --- a/src/java.base/share/classes/java/text/AttributedString.java +++ b/src/java.base/share/classes/java/text/AttributedString.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -776,12 +776,10 @@ public class AttributedString { if (this == obj) { return true; } - if (!(obj instanceof AttributedStringIterator)) { + if (!(obj instanceof AttributedStringIterator that)) { return false; } - AttributedStringIterator that = (AttributedStringIterator) obj; - if (AttributedString.this != that.getString()) return false; if (currentIndex != that.currentIndex || beginIndex != that.beginIndex || endIndex != that.endIndex) @@ -1096,10 +1094,9 @@ class AttributeEntry implements Map.Entry<Attribute,Object> { } public boolean equals(Object o) { - if (!(o instanceof AttributeEntry)) { + if (!(o instanceof AttributeEntry other)) { return false; } - AttributeEntry other = (AttributeEntry) o; return other.key.equals(key) && Objects.equals(other.value, value); } |
