On Mon, 24 Aug 2026 15:19:35 GMT, Andy Goryachev <[email protected]> wrote:

>> I would also rather like to see a `List` here. 
>> Right now, `Set<PseudoClass> pseudoClassStates = 
>> selector.getPseudoClassStates();` reads like we do not care about the order, 
>> just to see that we do care about it right after by using a `TreeSet`.
>> 
>> IMO we should not have a `Set` at all here, so if we for example write: 
>> `List<PseudoClass> pseudoClassStates =  
>> selector.getPseudoClassStates().stream().sorted(Comparator.comparing(PseudoClass::getPseudoClassName)).toList();`,
>>  it is immediately clear that we care about the order and we always use a 
>> `List`, never a `Set`.
>
> In this particular case, `Set<>` is fine - there is no point in having 
> duplicate pseudoclasses, and the order should not matter (I would be very 
> surprised to see different result for `:focused:selected` vs 
> `:selected:focused` ) 
> 
> But I came to like @mstr2 's suggestion with the `ArrayList<>`.

Me, too. Thanks for making the change.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2271#discussion_r3845010425

Reply via email to