On Sun, 1 Jan 2023 15:25:01 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

>> modules/javafx.base/src/main/java/javafx/collections/FXCollections.java line 
>> 1640:
>> 
>>> 1638:         @Override
>>> 1639:         public Iterator<E> iterator() {
>>> 1640:             return new Iterator<>() {
>> 
>> Here the empty `Set` creates a listener on invocation, unlike in the list 
>> case. Might want to keep a single pattern. I prefer the one with a singleton 
>> iterator because the empty set itself is a singleton. Same comment about 
>> considering "inlining" it.
>
> Can make these consistent if the approach is agreed upon.

So let's make the list and the set use an instance singleton pattern, like the 
empty list does.

-------------

PR: https://git.openjdk.org/jfx/pull/972

Reply via email to