File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
data/tests/model/src/main/java/io/helidon/data/tests/model Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 1818import java .util .ArrayList ;
1919import java .util .Collection ;
2020import java .util .Collections ;
21- import java .util .Iterator ;
21+ import java .util .HashSet ;
2222import java .util .List ;
2323import java .util .Objects ;
24+ import java .util .Set ;
2425
2526import jakarta .persistence .Entity ;
2627import jakarta .persistence .FetchType ;
@@ -210,18 +211,16 @@ private boolean typesEquals(Collection<Type> collection) {
210211 if (types .size () != collection .size ()) {
211212 return false ;
212213 }
213- Iterator <Type > typeIterator = types .iterator ();
214- Iterator <Type > collectionIterator = collection .iterator ();
215- int size = types .size ();
216- for (int i = 0 ; i < size ; i ++) {
217- if (typeIterator .hasNext () && collectionIterator .hasNext ()) {
218- if (!Objects .equals (typeIterator .next (), collectionIterator .next ())) {
219- return false ;
220- }
214+ Set <Type > collectionSet = new HashSet <>(collection .size ());
215+ collectionSet .addAll (collection );
216+ for (Type type : types ) {
217+ if (collectionSet .contains (type )) {
218+ collectionSet .remove (type );
221219 } else {
222220 return false ;
223221 }
224222 }
225- return true ;
223+ return collectionSet . isEmpty () ;
226224 }
225+
227226}
You can’t perform that action at this time.
0 commit comments