<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 <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 <nlisker@gmail.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr">We can do better than that. Instead of introducing 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 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ß <<a href="mailto:michaelstrau2@gmail.com">michaelstrau2@gmail.com</a>> 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>
 * Creates a new unmodifiable {@code ObservableList} that contains<br>
 * the concatenation of the contents of the specified observable lists.<br>
 * In contrast to {@link #concat(ObservableList[])}, the list returned from<br>
 * this method is updated when any of the source lists are changed.<br>
 *<br>
 * @param lists the source lists<br>
 * @param <E> the element type<br>
 * @return an {@code ObservableList} that contains the concatenation<br>
 *         of the contents of {@code lists}<br>
 * @throws IndexOutOfBoundsException if the sum of the number of<br>
 *         elements contained in all source lists exceeds<br>
 *         {@link Integer#MAX_VALUE}<br>
 */<br>
@SafeVarargs<br>
public static <E> ObservableList<E> concatenatedObservableList(<br>
        ObservableList<E>... lists)<br>
</blockquote></div>
</div></blockquote></div></body></html>