@@ -18,9 +18,9 @@ public static PropertyKeySet empty() {
1818
1919 public static PropertyKeySet ofCollection (Collection <? extends PropertyKey > collection ) {
2020 PropertyKeySet set = new PropertyKeySet ();
21- if (collection instanceof PropertyKeySet ) {
21+ if (collection instanceof PropertyKeySet pks ) {
2222 // simple copy
23- set .bits .or ((( PropertyKeySet ) collection ) .bits );
23+ set .bits .or (pks .bits );
2424 return set ;
2525 }
2626 for (PropertyKey key : collection ) {
@@ -51,10 +51,10 @@ public boolean isEmpty() {
5151
5252 @ Override
5353 public boolean contains (Object o ) {
54- if (!(o instanceof PropertyKey )) {
54+ if (!(o instanceof PropertyKey pk )) {
5555 return false ;
5656 }
57- return this .bits .get ((( PropertyKey ) o ) .getId ());
57+ return this .bits .get (pk .getId ());
5858 }
5959
6060 @ Nonnull
@@ -92,26 +92,26 @@ public boolean add(PropertyKey propertyKey) {
9292
9393 @ Override
9494 public boolean remove (Object o ) {
95- if (!(o instanceof PropertyKey )) {
95+ if (!(o instanceof PropertyKey pk )) {
9696 return false ;
9797 }
98- if (!this .bits .get ((( PropertyKey ) o ) .getId ())) {
98+ if (!this .bits .get (pk .getId ())) {
9999 return false ;
100100 }
101- this .bits .clear ((( PropertyKey ) o ) .getId ());
101+ this .bits .clear (pk .getId ());
102102 return true ;
103103 }
104104
105105 @ Override
106106 public boolean containsAll (@ Nonnull Collection <?> c ) {
107- if (c instanceof PropertyKeySet ) {
108- return (( PropertyKeySet ) c ) .bits .intersects (this .bits );
107+ if (c instanceof PropertyKeySet pks ) {
108+ return pks .bits .intersects (this .bits );
109109 }
110110 for (Object o : c ) {
111- if (!(o instanceof PropertyKey )) {
111+ if (!(o instanceof PropertyKey pk )) {
112112 return false ;
113113 }
114- if (!this .bits .get ((( PropertyKey ) o ) .getId ())) {
114+ if (!this .bits .get (pk .getId ())) {
115115 return false ;
116116 }
117117 }
@@ -121,8 +121,8 @@ public boolean containsAll(@Nonnull Collection<?> c) {
121121 @ Override
122122 public boolean addAll (@ Nonnull Collection <? extends PropertyKey > c ) {
123123 int cardinality = this .bits .cardinality ();
124- if (c instanceof PropertyKeySet ) {
125- this .bits .or ((( PropertyKeySet ) c ) .bits );
124+ if (c instanceof PropertyKeySet pks ) {
125+ this .bits .or (pks .bits );
126126 } else {
127127 for (PropertyKey key : c ) {
128128 this .bits .set (key .getId ());
@@ -135,8 +135,8 @@ public boolean addAll(@Nonnull Collection<? extends PropertyKey> c) {
135135 public boolean retainAll (@ Nonnull Collection <?> c ) {
136136 int cardinality = this .bits .cardinality ();
137137 BitSet removal ;
138- if (c instanceof PropertyKeySet ) {
139- removal = (( PropertyKeySet ) c ) .bits ;
138+ if (c instanceof PropertyKeySet pks ) {
139+ removal = pks .bits ;
140140 } else {
141141 removal = new BitSet (this .bits .length ());
142142 for (PropertyKey key : this ) {
@@ -152,12 +152,12 @@ public boolean retainAll(@Nonnull Collection<?> c) {
152152 @ Override
153153 public boolean removeAll (@ Nonnull Collection <?> c ) {
154154 int cardinality = this .bits .cardinality ();
155- if (c instanceof PropertyKeySet ) {
156- this .bits .andNot ((( PropertyKeySet ) c ) .bits );
155+ if (c instanceof PropertyKeySet pks ) {
156+ this .bits .andNot (pks .bits );
157157 } else {
158158 for (Object o : c ) { // mh
159- if (o instanceof PropertyKey ) {
160- this .bits .clear ((( PropertyKey ) o ) .getId ());
159+ if (o instanceof PropertyKey pk ) {
160+ this .bits .clear (pk .getId ());
161161 }
162162 }
163163 }
0 commit comments