Skip to content

Commit

Permalink
Optimize shouldUpdateAddressList method using containsAll
Browse files Browse the repository at this point in the history
  • Loading branch information
asapple committed Dec 10, 2024
1 parent 4f0c8ff commit 2152ae8
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,7 @@ private static boolean shouldUpdateAddressList(List<String> newAddresses, List<S
return true;
}

for (String addr : newAddresses) {
if (!oldAddresses.contains(addr)) {
return true;
}
}

return false;
return !new HashSet<>(newAddresses).containsAll(oldAddresses);
}

/**
Expand Down

0 comments on commit 2152ae8

Please sign in to comment.