RFR: 8332895: Support interpolation for backgrounds and borders [v3]

Nir Lisker nlisker at openjdk.org
Thu Sep 12 12:48:18 UTC 2024


On Sat, 3 Aug 2024 00:14:04 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> modules/javafx.base/src/main/java/com/sun/javafx/UnmodifiableArrayList.java line 81:
>> 
>>> 79: 
>>> 80:         @SuppressWarnings("unchecked")
>>> 81:         T[] newValues = (T[])new Object[list.size()];
>> 
>> With many `null`s this array may be too big.  If that's intended, then ignore this comment.
>
> That may be the case, but I think that's preferrable to requiring two iterations of the list (one to figure out how many non-null values it contains, the second to copy over the values). In practice, there shouldn't be any nulls in most cases, as I don't know why someone would construct a `Background` or `Border` with many nulls in there.

Is this code required to be so highly performant that you need to check for `RandomAccess`? Under normal circumstances, I would just stream the list and filter for `null`s.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1522#discussion_r1756788623


More information about the openjfx-dev mailing list