On 18/02/2023 05:43, Han Li wrote:
On Feb 17, 2023, at 17:17, Rémy Maucherat <[email protected]> wrote:
On Fri, Feb 17, 2023 at 4:32 AM <[email protected]> wrote:
- ciphers.removeAll(movedCiphers);
+ movedCiphers.forEach(ciphers::remove);
Ok for some of them maybe, but I don't understand why one this is better.
See:https://www.baeldung.com/java-hashset-removeall-performance
<https://www.baeldung.com/java-hashset-removeall-performance>
It’s just possible to avoid some potential performance issues. So i replaced
old writing style with this. :)
Those performance issues are when the collection the items are being
removed from is an ArrayList. These all look to be LinkedHashSet.
There may be a very small gain from these changes as it skips some logic
in removeAll() that isn't necessary in these instances.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]