[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: Concatenated observable list
From:       Scott Palmer <swpalmer () gmail ! com>
Date:       2022-12-31 22:15:56
Message-ID: 43AC2154-6E51-4086-AD5B-90F39AE93286 () gmail ! com
[Download RAW message or body]

[Attachment #2 (text/html)]

<html><head><meta http-equiv="content-type" content="text/html; \
charset=utf-8"></head><body dir="auto">+1 to doing something like this. I just \
recently discovered FXCollections.concat(ObservableList…) doesn't do&nbsp;<span \
style="-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, \
0); background-color: rgb(255, 255, 255);">what you propose. I figured that was the \
whole point.</span><div><font color="#000000"><span style="caret-color: rgb(0, 0, 0); \
-webkit-text-size-adjust: auto; background-color: rgb(255, 255, \
255);"><br></span></font><div dir="ltr">Scott</div><div dir="ltr"><br><blockquote \
type="cite">On Dec 31, 2022, at 3:44 PM, Nir Lisker &lt;nlisker@gmail.com&gt; \
wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div \
dir="ltr">We can do better than that. Instead of introducing&nbsp;methods for \
specific operations, like concat and retain, we can offer bulk operations on \
collections. When John H. proposed the fluent bindings additions, we discussed doing \
the same for collections after that.<div><br></div><div>At the very least, we can \
have a method that takes an observable collection and a function that specifies the \
operation you want to perform. This will be a lot more \
flexible.</div><div><br></div><div>I have been playing around with adding \
ObservableCollection as a first step so that we don't need to multiply the methods \
for sets and lists. It's also useful for an observableValues() on ObservableMap. I \
hit a few backwards compatibility issues there.</div><div><br></div><div>I can share \
later some mock API I created as a sort&nbsp;of end goal, but it's \
incomplete.</div></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Sat, Dec 31, 2022 at 8:15 PM Michael Strauß &lt;<a \
href="mailto:michaelstrau2@gmail.com">michaelstrau2@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">FXCollections.concat(ObservableList...) can be \
used to create a new<br> ObservableList that contains the concatenation of all \
elements of the<br> source lists. This is useful to initialize the contents of the \
new<br> ObservableList, but the returned list is not kept in sync with the<br>
source lists.<br>
<br>
I'm proposing to add a new method:<br>
FXCollections.concatenatedObservableList(ObservableList...)<br>
<br>
Like FXCollections.concat, it returns a list that contains the<br>
concatenation of all elements of the source lists. However, in this<br>
case the returned list is unmodifiable and is always kept in sync with<br>
the source lists. This can be useful to create a list where only parts<br>
of the list are under the control of the author, and other parts are<br>
derived from other lists.<br>
<br>
I'm interested to hear your thoughts on this. Here's the proposed<br>
specification of the new method:<br>
<br>
/**<br>
&nbsp;* Creates a new unmodifiable {@code ObservableList} that contains<br>
&nbsp;* the concatenation of the contents of the specified observable lists.<br>
&nbsp;* In contrast to {@link #concat(ObservableList[])}, the list returned from<br>
&nbsp;* this method is updated when any of the source lists are changed.<br>
&nbsp;*<br>
&nbsp;* @param lists the source lists<br>
&nbsp;* @param &lt;E&gt; the element type<br>
&nbsp;* @return an {@code ObservableList} that contains the concatenation<br>
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;of the contents of {@code lists}<br>
&nbsp;* @throws IndexOutOfBoundsException if the sum of the number of<br>
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;elements contained in all source lists \
exceeds<br> &nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{@link Integer#MAX_VALUE}<br>
&nbsp;*/<br>
@SafeVarargs<br>
public static &lt;E&gt; ObservableList&lt;E&gt; concatenatedObservableList(<br>
&nbsp; &nbsp; &nbsp; &nbsp; ObservableList&lt;E&gt;... lists)<br>
</blockquote></div>
</div></blockquote></div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic