On Sat, 12 Mar 2022 04:57:37 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
> `Observable{List/Set/Map}Wrapper.retainAll/removeAll` can be optimized for > some edge cases. > > 1. `removeAll(c)`: > This is a no-op if 'c' is empty. > For `ObservableListWrapper`, returning early skips an object allocation. For > `ObservableSetWrapper` and `ObservableMapWrapper`, returning early prevents > an enumeration of the entire collection. > > 2. `retainAll(c)`: > This is a no-op if the backing collection is empty, or equivalent to > `clear()` if `c` is empty. > > I've added some tests to verify the optimized behavior for each of the three > classes. This pull request has now been integrated. Changeset: b6e5737c Author: Michael Strauß <mstra...@openjdk.org> URL: https://git.openjdk.org/jfx/commit/b6e5737c7a25544f61778254613a4dd42ca2b96c Stats: 988 lines in 11 files changed: 964 ins; 8 del; 16 mod 8283063: Optimize Observable{List/Set/Map}Wrapper.retainAll/removeAll Reviewed-by: nlisker, jhendrikx ------------- PR: https://git.openjdk.org/jfx/pull/751