FilteringBindings.java
0001 /*
0002  * Copyright 2008-2017 the original author or authors.
0003  *
0004  * Licensed under the Apache License, Version 2.0 (the "License");
0005  * you may not use this file except in compliance with the License.
0006  * You may obtain a copy of the License at
0007  *
0008  *     http://www.apache.org/licenses/LICENSE-2.0
0009  *
0010  * Unless required by applicable law or agreed to in writing, software
0011  * distributed under the License is distributed on an "AS IS" BASIS,
0012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013  * See the License for the specific language governing permissions and
0014  * limitations under the License.
0015  */
0016 package griffon.javafx.beans.binding;
0017 
0018 import javafx.beans.binding.BooleanBinding;
0019 import javafx.beans.binding.DoubleBinding;
0020 import javafx.beans.binding.FloatBinding;
0021 import javafx.beans.binding.IntegerBinding;
0022 import javafx.beans.binding.LongBinding;
0023 import javafx.beans.binding.ObjectBinding;
0024 import javafx.beans.binding.StringBinding;
0025 import javafx.beans.value.ObservableValue;
0026 import javafx.collections.ObservableList;
0027 import javafx.collections.ObservableMap;
0028 import javafx.collections.ObservableSet;
0029 
0030 import javax.annotation.Nonnull;
0031 import java.util.function.Function;
0032 import java.util.function.Predicate;
0033 import java.util.function.Supplier;
0034 
0035 import static java.util.Objects.requireNonNull;
0036 import static javafx.beans.binding.Bindings.createBooleanBinding;
0037 import static javafx.beans.binding.Bindings.createDoubleBinding;
0038 import static javafx.beans.binding.Bindings.createFloatBinding;
0039 import static javafx.beans.binding.Bindings.createIntegerBinding;
0040 import static javafx.beans.binding.Bindings.createLongBinding;
0041 import static javafx.beans.binding.Bindings.createObjectBinding;
0042 import static javafx.beans.binding.Bindings.createStringBinding;
0043 
0044 /**
0045  @author Andres Almiray
0046  @since 2.10.0
0047  */
0048 public final class FilteringBindings {
0049     private static final String ERROR_ITEMS_NULL = "Argument 'items' must not be null";
0050     private static final String ERROR_FILTER_NULL = "Argument 'filter' must not be null";
0051     private static final String ERROR_MAPPER_NULL = "Argument 'mapper' must not be null";
0052     private static final String ERROR_SUPPLIER_NULL = "Argument 'supplier' must not be null";
0053 
0054     private FilteringBindings() {
0055         // prevent instantiation
0056     }
0057 
0058     /**
0059      * Creates an object binding with the first element of an observable list after filtering.
0060      *
0061      @param items        the observable list of items.
0062      @param defaultValue the value to be returned if there is no value present.
0063      @param filter       a non-interfering, stateless predicate to apply to the each element.
0064      *
0065      @return an object binding
0066      */
0067     @Nonnull
0068     public static <T> ObjectBinding<T> filterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final T defaultValue, @Nonnull final Predicate<? super T> filter) {
0069         requireNonNull(items, ERROR_ITEMS_NULL);
0070         requireNonNull(filter, ERROR_FILTER_NULL);
0071         return createObjectBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0072     }
0073 
0074     /**
0075      * Creates an object binding with the first element of an observable list after filtering.
0076      *
0077      @param items    the observable list of items.
0078      @param supplier a {@code Supplier} whose result is returned if no value is present.
0079      @param filter   a non-interfering, stateless predicate to apply to the each element.
0080      *
0081      @return an object binding
0082      */
0083     @Nonnull
0084     public static <T> ObjectBinding<T> filterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<T> supplier, @Nonnull final Predicate<? super T> filter) {
0085         requireNonNull(items, ERROR_ITEMS_NULL);
0086         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0087         requireNonNull(filter, ERROR_FILTER_NULL);
0088         return createObjectBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0089     }
0090 
0091     /**
0092      * Creates an object binding with the first element of an observable list after filtering.
0093      *
0094      @param items        the observable list of items.
0095      @param defaultValue the value to be returned if there is no value present.
0096      @param filter       a non-interfering, stateless predicate to apply to the each element.
0097      *
0098      @return an object binding
0099      */
0100     @Nonnull
0101     public static <T> ObjectBinding<T> filterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final T defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter) {
0102         requireNonNull(items, ERROR_ITEMS_NULL);
0103         requireNonNull(filter, ERROR_FILTER_NULL);
0104         return createObjectBinding(() -> {
0105             Predicate<? super T> filterValue = filter.getValue();
0106             requireNonNull(filterValue, ERROR_FILTER_NULL);
0107             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0108         }, items, filter);
0109     }
0110 
0111     /**
0112      * Creates an object binding with the first element of an observable list after filtering.
0113      *
0114      @param items    the observable list of items.
0115      @param supplier a {@code Supplier} whose result is returned if no value is present.
0116      @param filter   a non-interfering, stateless predicate to apply to the each element.
0117      *
0118      @return an object binding
0119      */
0120     @Nonnull
0121     public static <T> ObjectBinding<T> filterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<T> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter) {
0122         requireNonNull(items, ERROR_ITEMS_NULL);
0123         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0124         requireNonNull(filter, ERROR_FILTER_NULL);
0125         return createObjectBinding(() -> {
0126             Predicate<? super T> filterValue = filter.getValue();
0127             requireNonNull(filterValue, ERROR_FILTER_NULL);
0128             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0129         }, items, filter);
0130     }
0131 
0132     /**
0133      * Creates a boolean binding with the first element of an observable list after filtering.
0134      *
0135      @param items        the observable list of items.
0136      @param defaultValue the value to be returned if there is no value present.
0137      @param filter       a non-interfering, stateless predicate to apply to the each element.
0138      *
0139      @return a boolean binding
0140      */
0141     @Nonnull
0142     public static BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableList<Boolean> items, @Nonnull final Boolean defaultValue, @Nonnull final Predicate<? super Boolean> filter) {
0143         requireNonNull(items, ERROR_ITEMS_NULL);
0144         requireNonNull(filter, ERROR_FILTER_NULL);
0145         return createBooleanBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0146     }
0147 
0148     /**
0149      * Creates a boolean binding with the first element of an observable list after filtering.
0150      *
0151      @param items    the observable list of items.
0152      @param supplier a {@code Supplier} whose result is returned if no value is present.
0153      @param filter   a non-interfering, stateless predicate to apply to the each element.
0154      *
0155      @return a boolean binding
0156      */
0157     @Nonnull
0158     public static BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableList<Boolean> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Predicate<? super Boolean> filter) {
0159         requireNonNull(items, ERROR_ITEMS_NULL);
0160         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0161         requireNonNull(filter, ERROR_FILTER_NULL);
0162         return createBooleanBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0163     }
0164 
0165     /**
0166      * Creates a boolean binding with the first element of an observable list after filtering.
0167      *
0168      @param items        the observable list of items.
0169      @param defaultValue the value to be returned if there is no value present.
0170      @param filter       a non-interfering, stateless predicate to apply to the each element.
0171      *
0172      @return a boolean binding
0173      */
0174     @Nonnull
0175     public static BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableList<Boolean> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Predicate<? super Boolean>> filter) {
0176         requireNonNull(items, ERROR_ITEMS_NULL);
0177         requireNonNull(filter, ERROR_FILTER_NULL);
0178         return createBooleanBinding(() -> {
0179             Predicate<? super Boolean> filterValue = filter.getValue();
0180             requireNonNull(filterValue, ERROR_FILTER_NULL);
0181             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0182         }, items, filter);
0183     }
0184 
0185     /**
0186      * Creates a boolean binding with the first element of an observable list after filtering.
0187      *
0188      @param items    the observable list of items.
0189      @param supplier a {@code Supplier} whose result is returned if no value is present.
0190      @param filter   a non-interfering, stateless predicate to apply to the each element.
0191      *
0192      @return a boolean binding
0193      */
0194     @Nonnull
0195     public static BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableList<Boolean> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Predicate<? super Boolean>> filter) {
0196         requireNonNull(items, ERROR_ITEMS_NULL);
0197         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0198         requireNonNull(filter, ERROR_FILTER_NULL);
0199         return createBooleanBinding(() -> {
0200             Predicate<? super Boolean> filterValue = filter.getValue();
0201             requireNonNull(filterValue, ERROR_FILTER_NULL);
0202             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0203         }, items, filter);
0204     }
0205 
0206     /**
0207      * Creates an integer binding with the first element of an observable list after filtering.
0208      *
0209      @param items        the observable list of items.
0210      @param defaultValue the value to be returned if there is no value present.
0211      @param filter       a non-interfering, stateless predicate to apply to the each element.
0212      *
0213      @return an integer binding
0214      */
0215     @Nonnull
0216     public static IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableList<Integer> items, @Nonnull final Integer defaultValue, @Nonnull final Predicate<? super Integer> filter) {
0217         requireNonNull(items, ERROR_ITEMS_NULL);
0218         requireNonNull(filter, ERROR_FILTER_NULL);
0219         return createIntegerBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0220     }
0221 
0222     /**
0223      * Creates an integer binding with the first element of an observable list after filtering.
0224      *
0225      @param items    the observable list of items.
0226      @param supplier a {@code Supplier} whose result is returned if no value is present.
0227      @param filter   a non-interfering, stateless predicate to apply to the each element.
0228      *
0229      @return an integer binding
0230      */
0231     @Nonnull
0232     public static IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableList<Integer> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Predicate<? super Integer> filter) {
0233         requireNonNull(items, ERROR_ITEMS_NULL);
0234         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0235         requireNonNull(filter, ERROR_FILTER_NULL);
0236         return createIntegerBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0237     }
0238 
0239     /**
0240      * Creates an integer binding with the first element of an observable list after filtering.
0241      *
0242      @param items        the observable list of items.
0243      @param defaultValue the value to be returned if there is no value present.
0244      @param filter       a non-interfering, stateless predicate to apply to the each element.
0245      *
0246      @return an integer binding
0247      */
0248     @Nonnull
0249     public static IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableList<Integer> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Predicate<? super Integer>> filter) {
0250         requireNonNull(items, ERROR_ITEMS_NULL);
0251         requireNonNull(filter, ERROR_FILTER_NULL);
0252         return createIntegerBinding(() -> {
0253             Predicate<? super Integer> filterValue = filter.getValue();
0254             requireNonNull(filterValue, ERROR_FILTER_NULL);
0255             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0256         }, items, filter);
0257     }
0258 
0259     /**
0260      * Creates an integer binding with the first element of an observable list after filtering.
0261      *
0262      @param items    the observable list of items.
0263      @param supplier a {@code Supplier} whose result is returned if no value is present.
0264      @param filter   a non-interfering, stateless predicate to apply to the each element.
0265      *
0266      @return an integer binding
0267      */
0268     @Nonnull
0269     public static IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableList<Integer> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Predicate<? super Integer>> filter) {
0270         requireNonNull(items, ERROR_ITEMS_NULL);
0271         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0272         requireNonNull(filter, ERROR_FILTER_NULL);
0273         return createIntegerBinding(() -> {
0274             Predicate<? super Integer> filterValue = filter.getValue();
0275             requireNonNull(filterValue, ERROR_FILTER_NULL);
0276             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0277         }, items, filter);
0278     }
0279 
0280     /**
0281      * Creates a long binding with the first element of an observable list after filtering.
0282      *
0283      @param items        the observable list of items.
0284      @param defaultValue the value to be returned if there is no value present.
0285      @param filter       a non-interfering, stateless predicate to apply to the each element.
0286      *
0287      @return a long binding
0288      */
0289     @Nonnull
0290     public static LongBinding filterThenFindFirstLong(@Nonnull final ObservableList<Long> items, @Nonnull final Long defaultValue, @Nonnull final Predicate<? super Long> filter) {
0291         requireNonNull(items, ERROR_ITEMS_NULL);
0292         requireNonNull(filter, ERROR_FILTER_NULL);
0293         return createLongBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0294     }
0295 
0296     /**
0297      * Creates a long binding with the first element of an observable list after filtering.
0298      *
0299      @param items    the observable list of items.
0300      @param supplier a {@code Supplier} whose result is returned if no value is present.
0301      @param filter   a non-interfering, stateless predicate to apply to the each element.
0302      *
0303      @return a long binding
0304      */
0305     @Nonnull
0306     public static LongBinding filterThenFindFirstLong(@Nonnull final ObservableList<Long> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Predicate<? super Long> filter) {
0307         requireNonNull(items, ERROR_ITEMS_NULL);
0308         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0309         requireNonNull(filter, ERROR_FILTER_NULL);
0310         return createLongBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0311     }
0312 
0313     /**
0314      * Creates a long binding with the first element of an observable list after filtering.
0315      *
0316      @param items        the observable list of items.
0317      @param defaultValue the value to be returned if there is no value present.
0318      @param filter       a non-interfering, stateless predicate to apply to the each element.
0319      *
0320      @return a long binding
0321      */
0322     @Nonnull
0323     public static LongBinding filterThenFindFirstLong(@Nonnull final ObservableList<Long> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Predicate<? super Long>> filter) {
0324         requireNonNull(items, ERROR_ITEMS_NULL);
0325         requireNonNull(filter, ERROR_FILTER_NULL);
0326         return createLongBinding(() -> {
0327             Predicate<? super Long> filterValue = filter.getValue();
0328             requireNonNull(filterValue, ERROR_FILTER_NULL);
0329             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0330         }, items, filter);
0331     }
0332 
0333     /**
0334      * Creates a long binding with the first element of an observable list after filtering.
0335      *
0336      @param items    the observable list of items.
0337      @param supplier a {@code Supplier} whose result is returned if no value is present.
0338      @param filter   a non-interfering, stateless predicate to apply to the each element.
0339      *
0340      @return a long binding
0341      */
0342     @Nonnull
0343     public static LongBinding filterThenFindFirstLong(@Nonnull final ObservableList<Long> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Predicate<? super Long>> filter) {
0344         requireNonNull(items, ERROR_ITEMS_NULL);
0345         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0346         requireNonNull(filter, ERROR_FILTER_NULL);
0347         return createLongBinding(() -> {
0348             Predicate<? super Long> filterValue = filter.getValue();
0349             requireNonNull(filterValue, ERROR_FILTER_NULL);
0350             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0351         }, items, filter);
0352     }
0353 
0354     /**
0355      * Creates a float binding with the first element of an observable list after filtering.
0356      *
0357      @param items        the observable list of items.
0358      @param defaultValue the value to be returned if there is no value present.
0359      @param filter       a non-interfering, stateless predicate to apply to the each element.
0360      *
0361      @return a float binding
0362      */
0363     @Nonnull
0364     public static FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableList<Float> items, @Nonnull final Float defaultValue, @Nonnull final Predicate<? super Float> filter) {
0365         requireNonNull(items, ERROR_ITEMS_NULL);
0366         requireNonNull(filter, ERROR_FILTER_NULL);
0367         return createFloatBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0368     }
0369 
0370     /**
0371      * Creates a float binding with the first element of an observable list after filtering.
0372      *
0373      @param items    the observable list of items.
0374      @param supplier a {@code Supplier} whose result is returned if no value is present.
0375      @param filter   a non-interfering, stateless predicate to apply to the each element.
0376      *
0377      @return a float binding
0378      */
0379     @Nonnull
0380     public static FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableList<Float> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Predicate<? super Float> filter) {
0381         requireNonNull(items, ERROR_ITEMS_NULL);
0382         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0383         requireNonNull(filter, ERROR_FILTER_NULL);
0384         return createFloatBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0385     }
0386 
0387     /**
0388      * Creates a float binding with the first element of an observable list after filtering.
0389      *
0390      @param items        the observable list of items.
0391      @param defaultValue the value to be returned if there is no value present.
0392      @param filter       a non-interfering, stateless predicate to apply to the each element.
0393      *
0394      @return a float binding
0395      */
0396     @Nonnull
0397     public static FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableList<Float> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Predicate<? super Float>> filter) {
0398         requireNonNull(items, ERROR_ITEMS_NULL);
0399         requireNonNull(filter, ERROR_FILTER_NULL);
0400         return createFloatBinding(() -> {
0401             Predicate<? super Float> filterValue = filter.getValue();
0402             requireNonNull(filterValue, ERROR_FILTER_NULL);
0403             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0404         }, items, filter);
0405     }
0406 
0407     /**
0408      * Creates a float binding with the first element of an observable list after filtering.
0409      *
0410      @param items    the observable list of items.
0411      @param supplier a {@code Supplier} whose result is returned if no value is present.
0412      @param filter   a non-interfering, stateless predicate to apply to the each element.
0413      *
0414      @return a float binding
0415      */
0416     @Nonnull
0417     public static FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableList<Float> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Predicate<? super Float>> filter) {
0418         requireNonNull(items, ERROR_ITEMS_NULL);
0419         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0420         requireNonNull(filter, ERROR_FILTER_NULL);
0421         return createFloatBinding(() -> {
0422             Predicate<? super Float> filterValue = filter.getValue();
0423             requireNonNull(filterValue, ERROR_FILTER_NULL);
0424             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0425         }, items, filter);
0426     }
0427 
0428     /**
0429      * Creates a double binding with the first element of an observable list after filtering.
0430      *
0431      @param items        the observable list of items.
0432      @param defaultValue the value to be returned if there is no value present.
0433      @param filter       a non-interfering, stateless predicate to apply to the each element.
0434      *
0435      @return a double binding
0436      */
0437     @Nonnull
0438     public static DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableList<Double> items, @Nonnull final Double defaultValue, @Nonnull final Predicate<? super Double> filter) {
0439         requireNonNull(items, ERROR_ITEMS_NULL);
0440         requireNonNull(filter, ERROR_FILTER_NULL);
0441         return createDoubleBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0442     }
0443 
0444     /**
0445      * Creates a double binding with the first element of an observable list after filtering.
0446      *
0447      @param items    the observable list of items.
0448      @param supplier a {@code Supplier} whose result is returned if no value is present.
0449      @param filter   a non-interfering, stateless predicate to apply to the each element.
0450      *
0451      @return a double binding
0452      */
0453     @Nonnull
0454     public static DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableList<Double> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Predicate<? super Double> filter) {
0455         requireNonNull(items, ERROR_ITEMS_NULL);
0456         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0457         requireNonNull(filter, ERROR_FILTER_NULL);
0458         return createDoubleBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0459     }
0460 
0461     /**
0462      * Creates a double binding with the first element of an observable list after filtering.
0463      *
0464      @param items        the observable list of items.
0465      @param defaultValue the value to be returned if there is no value present.
0466      @param filter       a non-interfering, stateless predicate to apply to the each element.
0467      *
0468      @return a double binding
0469      */
0470     @Nonnull
0471     public static DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableList<Double> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Predicate<? super Double>> filter) {
0472         requireNonNull(items, ERROR_ITEMS_NULL);
0473         requireNonNull(filter, ERROR_FILTER_NULL);
0474         return createDoubleBinding(() -> {
0475             Predicate<? super Double> filterValue = filter.getValue();
0476             requireNonNull(filterValue, ERROR_FILTER_NULL);
0477             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0478         }, items, filter);
0479     }
0480 
0481     /**
0482      * Creates a double binding with the first element of an observable list after filtering.
0483      *
0484      @param items    the observable list of items.
0485      @param supplier a {@code Supplier} whose result is returned if no value is present.
0486      @param filter   a non-interfering, stateless predicate to apply to the each element.
0487      *
0488      @return a double binding
0489      */
0490     @Nonnull
0491     public static DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableList<Double> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Predicate<? super Double>> filter) {
0492         requireNonNull(items, ERROR_ITEMS_NULL);
0493         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0494         requireNonNull(filter, ERROR_FILTER_NULL);
0495         return createDoubleBinding(() -> {
0496             Predicate<? super Double> filterValue = filter.getValue();
0497             requireNonNull(filterValue, ERROR_FILTER_NULL);
0498             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0499         }, items, filter);
0500     }
0501 
0502     /**
0503      * Creates a string binding with the first element of an observable list after filtering.
0504      *
0505      @param items        the observable list of items.
0506      @param defaultValue the value to be returned if there is no value present.
0507      @param filter       a non-interfering, stateless predicate to apply to the each element.
0508      *
0509      @return a string binding
0510      */
0511     @Nonnull
0512     public static StringBinding filterThenFindFirstString(@Nonnull final ObservableList<String> items, @Nonnull final String defaultValue, @Nonnull final Predicate<? super String> filter) {
0513         requireNonNull(items, ERROR_ITEMS_NULL);
0514         requireNonNull(filter, ERROR_FILTER_NULL);
0515         return createStringBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0516     }
0517 
0518     /**
0519      * Creates a string binding with the first element of an observable list after filtering.
0520      *
0521      @param items    the observable list of items.
0522      @param supplier a {@code Supplier} whose result is returned if no value is present.
0523      @param filter   a non-interfering, stateless predicate to apply to the each element.
0524      *
0525      @return a string binding
0526      */
0527     @Nonnull
0528     public static StringBinding filterThenFindFirstString(@Nonnull final ObservableList<String> items, @Nonnull final Supplier<String> supplier, @Nonnull final Predicate<? super String> filter) {
0529         requireNonNull(items, ERROR_ITEMS_NULL);
0530         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0531         requireNonNull(filter, ERROR_FILTER_NULL);
0532         return createStringBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0533     }
0534 
0535     /**
0536      * Creates a string binding with the first element of an observable list after filtering.
0537      *
0538      @param items        the observable list of items.
0539      @param defaultValue the value to be returned if there is no value present.
0540      @param filter       a non-interfering, stateless predicate to apply to the each element.
0541      *
0542      @return a string binding
0543      */
0544     @Nonnull
0545     public static StringBinding filterThenFindFirstString(@Nonnull final ObservableList<String> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Predicate<? super String>> filter) {
0546         requireNonNull(items, ERROR_ITEMS_NULL);
0547         requireNonNull(filter, ERROR_FILTER_NULL);
0548         return createStringBinding(() -> {
0549             Predicate<? super String> filterValue = filter.getValue();
0550             requireNonNull(filterValue, ERROR_FILTER_NULL);
0551             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0552         }, items, filter);
0553     }
0554 
0555     /**
0556      * Creates a string binding with the first element of an observable list after filtering.
0557      *
0558      @param items    the observable list of items.
0559      @param supplier a {@code Supplier} whose result is returned if no value is present.
0560      @param filter   a non-interfering, stateless predicate to apply to the each element.
0561      *
0562      @return a string binding
0563      */
0564     @Nonnull
0565     public static StringBinding filterThenFindFirstString(@Nonnull final ObservableList<String> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Predicate<? super String>> filter) {
0566         requireNonNull(items, ERROR_ITEMS_NULL);
0567         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0568         requireNonNull(filter, ERROR_FILTER_NULL);
0569         return createStringBinding(() -> {
0570             Predicate<? super String> filterValue = filter.getValue();
0571             requireNonNull(filterValue, ERROR_FILTER_NULL);
0572             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0573         }, items, filter);
0574     }
0575 
0576     /**
0577      * Creates an object binding with the first element of an observable set after filtering.
0578      *
0579      @param items        the observable set of items.
0580      @param defaultValue the value to be returned if there is no value present.
0581      @param filter       a non-interfering, stateless predicate to apply to the each element.
0582      *
0583      @return an object binding
0584      */
0585     @Nonnull
0586     public static <T> ObjectBinding<T> filterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final T defaultValue, @Nonnull final Predicate<? super T> filter) {
0587         requireNonNull(items, ERROR_ITEMS_NULL);
0588         requireNonNull(filter, ERROR_FILTER_NULL);
0589         return createObjectBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0590     }
0591 
0592     /**
0593      * Creates an object binding with the first element of an observable set after filtering.
0594      *
0595      @param items    the observable set of items.
0596      @param supplier a {@code Supplier} whose result is returned if no value is present.
0597      @param filter   a non-interfering, stateless predicate to apply to the each element.
0598      *
0599      @return an object binding
0600      */
0601     @Nonnull
0602     public static <T> ObjectBinding<T> filterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<T> supplier, @Nonnull final Predicate<? super T> filter) {
0603         requireNonNull(items, ERROR_ITEMS_NULL);
0604         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0605         requireNonNull(filter, ERROR_FILTER_NULL);
0606         return createObjectBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0607     }
0608 
0609     /**
0610      * Creates an object binding with the first element of an observable set after filtering.
0611      *
0612      @param items        the observable set of items.
0613      @param defaultValue the value to be returned if there is no value present.
0614      @param filter       a non-interfering, stateless predicate to apply to the each element.
0615      *
0616      @return an object binding
0617      */
0618     @Nonnull
0619     public static <T> ObjectBinding<T> filterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final T defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter) {
0620         requireNonNull(items, ERROR_ITEMS_NULL);
0621         requireNonNull(filter, ERROR_FILTER_NULL);
0622         return createObjectBinding(() -> {
0623             Predicate<? super T> filterValue = filter.getValue();
0624             requireNonNull(filterValue, ERROR_FILTER_NULL);
0625             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0626         }, items, filter);
0627     }
0628 
0629     /**
0630      * Creates an object binding with the first element of an observable set after filtering.
0631      *
0632      @param items    the observable set of items.
0633      @param supplier a {@code Supplier} whose result is returned if no value is present.
0634      @param filter   a non-interfering, stateless predicate to apply to the each element.
0635      *
0636      @return an object binding
0637      */
0638     @Nonnull
0639     public static <T> ObjectBinding<T> filterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<T> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter) {
0640         requireNonNull(items, ERROR_ITEMS_NULL);
0641         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0642         requireNonNull(filter, ERROR_FILTER_NULL);
0643         return createObjectBinding(() -> {
0644             Predicate<? super T> filterValue = filter.getValue();
0645             requireNonNull(filterValue, ERROR_FILTER_NULL);
0646             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0647         }, items, filter);
0648     }
0649 
0650     /**
0651      * Creates a boolean binding with the first element of an observable set after filtering.
0652      *
0653      @param items        the observable set of items.
0654      @param defaultValue the value to be returned if there is no value present.
0655      @param filter       a non-interfering, stateless predicate to apply to the each element.
0656      *
0657      @return a boolean binding
0658      */
0659     @Nonnull
0660     public static BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableSet<Boolean> items, @Nonnull final Boolean defaultValue, @Nonnull final Predicate<? super Boolean> filter) {
0661         requireNonNull(items, ERROR_ITEMS_NULL);
0662         requireNonNull(filter, ERROR_FILTER_NULL);
0663         return createBooleanBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0664     }
0665 
0666     /**
0667      * Creates a boolean binding with the first element of an observable set after filtering.
0668      *
0669      @param items    the observable set of items.
0670      @param supplier a {@code Supplier} whose result is returned if no value is present.
0671      @param filter   a non-interfering, stateless predicate to apply to the each element.
0672      *
0673      @return a boolean binding
0674      */
0675     @Nonnull
0676     public static BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableSet<Boolean> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Predicate<? super Boolean> filter) {
0677         requireNonNull(items, ERROR_ITEMS_NULL);
0678         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0679         requireNonNull(filter, ERROR_FILTER_NULL);
0680         return createBooleanBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0681     }
0682 
0683     /**
0684      * Creates a boolean binding with the first element of an observable set after filtering.
0685      *
0686      @param items        the observable set of items.
0687      @param defaultValue the value to be returned if there is no value present.
0688      @param filter       a non-interfering, stateless predicate to apply to the each element.
0689      *
0690      @return a boolean binding
0691      */
0692     @Nonnull
0693     public static BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableSet<Boolean> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Predicate<? super Boolean>> filter) {
0694         requireNonNull(items, ERROR_ITEMS_NULL);
0695         requireNonNull(filter, ERROR_FILTER_NULL);
0696         return createBooleanBinding(() -> {
0697             Predicate<? super Boolean> filterValue = filter.getValue();
0698             requireNonNull(filterValue, ERROR_FILTER_NULL);
0699             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0700         }, items, filter);
0701     }
0702 
0703     /**
0704      * Creates a boolean binding with the first element of an observable set after filtering.
0705      *
0706      @param items    the observable set of items.
0707      @param supplier a {@code Supplier} whose result is returned if no value is present.
0708      @param filter   a non-interfering, stateless predicate to apply to the each element.
0709      *
0710      @return a boolean binding
0711      */
0712     @Nonnull
0713     public static BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableSet<Boolean> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Predicate<? super Boolean>> filter) {
0714         requireNonNull(items, ERROR_ITEMS_NULL);
0715         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0716         requireNonNull(filter, ERROR_FILTER_NULL);
0717         return createBooleanBinding(() -> {
0718             Predicate<? super Boolean> filterValue = filter.getValue();
0719             requireNonNull(filterValue, ERROR_FILTER_NULL);
0720             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0721         }, items, filter);
0722     }
0723 
0724     /**
0725      * Creates an integer binding with the first element of an observable set after filtering.
0726      *
0727      @param items        the observable set of items.
0728      @param defaultValue the value to be returned if there is no value present.
0729      @param filter       a non-interfering, stateless predicate to apply to the each element.
0730      *
0731      @return an integer binding
0732      */
0733     @Nonnull
0734     public static IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableSet<Integer> items, @Nonnull final Integer defaultValue, @Nonnull final Predicate<? super Integer> filter) {
0735         requireNonNull(items, ERROR_ITEMS_NULL);
0736         requireNonNull(filter, ERROR_FILTER_NULL);
0737         return createIntegerBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0738     }
0739 
0740     /**
0741      * Creates an integer binding with the first element of an observable set after filtering.
0742      *
0743      @param items    the observable set of items.
0744      @param supplier a {@code Supplier} whose result is returned if no value is present.
0745      @param filter   a non-interfering, stateless predicate to apply to the each element.
0746      *
0747      @return an integer binding
0748      */
0749     @Nonnull
0750     public static IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableSet<Integer> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Predicate<? super Integer> filter) {
0751         requireNonNull(items, ERROR_ITEMS_NULL);
0752         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0753         requireNonNull(filter, ERROR_FILTER_NULL);
0754         return createIntegerBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0755     }
0756 
0757     /**
0758      * Creates an integer binding with the first element of an observable set after filtering.
0759      *
0760      @param items        the observable set of items.
0761      @param defaultValue the value to be returned if there is no value present.
0762      @param filter       a non-interfering, stateless predicate to apply to the each element.
0763      *
0764      @return an integer binding
0765      */
0766     @Nonnull
0767     public static IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableSet<Integer> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Predicate<? super Integer>> filter) {
0768         requireNonNull(items, ERROR_ITEMS_NULL);
0769         requireNonNull(filter, ERROR_FILTER_NULL);
0770         return createIntegerBinding(() -> {
0771             Predicate<? super Integer> filterValue = filter.getValue();
0772             requireNonNull(filterValue, ERROR_FILTER_NULL);
0773             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0774         }, items, filter);
0775     }
0776 
0777     /**
0778      * Creates an integer binding with the first element of an observable set after filtering.
0779      *
0780      @param items    the observable set of items.
0781      @param supplier a {@code Supplier} whose result is returned if no value is present.
0782      @param filter   a non-interfering, stateless predicate to apply to the each element.
0783      *
0784      @return an integer binding
0785      */
0786     @Nonnull
0787     public static IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableSet<Integer> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Predicate<? super Integer>> filter) {
0788         requireNonNull(items, ERROR_ITEMS_NULL);
0789         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0790         requireNonNull(filter, ERROR_FILTER_NULL);
0791         return createIntegerBinding(() -> {
0792             Predicate<? super Integer> filterValue = filter.getValue();
0793             requireNonNull(filterValue, ERROR_FILTER_NULL);
0794             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0795         }, items, filter);
0796     }
0797 
0798     /**
0799      * Creates a long binding with the first element of an observable set after filtering.
0800      *
0801      @param items        the observable set of items.
0802      @param defaultValue the value to be returned if there is no value present.
0803      @param filter       a non-interfering, stateless predicate to apply to the each element.
0804      *
0805      @return a long binding
0806      */
0807     @Nonnull
0808     public static LongBinding filterThenFindFirstLong(@Nonnull final ObservableSet<Long> items, @Nonnull final Long defaultValue, @Nonnull final Predicate<? super Long> filter) {
0809         requireNonNull(items, ERROR_ITEMS_NULL);
0810         requireNonNull(filter, ERROR_FILTER_NULL);
0811         return createLongBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0812     }
0813 
0814     /**
0815      * Creates a long binding with the first element of an observable set after filtering.
0816      *
0817      @param items    the observable set of items.
0818      @param supplier a {@code Supplier} whose result is returned if no value is present.
0819      @param filter   a non-interfering, stateless predicate to apply to the each element.
0820      *
0821      @return a long binding
0822      */
0823     @Nonnull
0824     public static LongBinding filterThenFindFirstLong(@Nonnull final ObservableSet<Long> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Predicate<? super Long> filter) {
0825         requireNonNull(items, ERROR_ITEMS_NULL);
0826         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0827         requireNonNull(filter, ERROR_FILTER_NULL);
0828         return createLongBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0829     }
0830 
0831     /**
0832      * Creates a long binding with the first element of an observable set after filtering.
0833      *
0834      @param items        the observable set of items.
0835      @param defaultValue the value to be returned if there is no value present.
0836      @param filter       a non-interfering, stateless predicate to apply to the each element.
0837      *
0838      @return a long binding
0839      */
0840     @Nonnull
0841     public static LongBinding filterThenFindFirstLong(@Nonnull final ObservableSet<Long> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Predicate<? super Long>> filter) {
0842         requireNonNull(items, ERROR_ITEMS_NULL);
0843         requireNonNull(filter, ERROR_FILTER_NULL);
0844         return createLongBinding(() -> {
0845             Predicate<? super Long> filterValue = filter.getValue();
0846             requireNonNull(filterValue, ERROR_FILTER_NULL);
0847             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0848         }, items, filter);
0849     }
0850 
0851     /**
0852      * Creates a long binding with the first element of an observable set after filtering.
0853      *
0854      @param items    the observable set of items.
0855      @param supplier a {@code Supplier} whose result is returned if no value is present.
0856      @param filter   a non-interfering, stateless predicate to apply to the each element.
0857      *
0858      @return a long binding
0859      */
0860     @Nonnull
0861     public static LongBinding filterThenFindFirstLong(@Nonnull final ObservableSet<Long> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Predicate<? super Long>> filter) {
0862         requireNonNull(items, ERROR_ITEMS_NULL);
0863         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0864         requireNonNull(filter, ERROR_FILTER_NULL);
0865         return createLongBinding(() -> {
0866             Predicate<? super Long> filterValue = filter.getValue();
0867             requireNonNull(filterValue, ERROR_FILTER_NULL);
0868             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0869         }, items, filter);
0870     }
0871 
0872     /**
0873      * Creates a float binding with the first element of an observable set after filtering.
0874      *
0875      @param items        the observable set of items.
0876      @param defaultValue the value to be returned if there is no value present.
0877      @param filter       a non-interfering, stateless predicate to apply to the each element.
0878      *
0879      @return a float binding
0880      */
0881     @Nonnull
0882     public static FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableSet<Float> items, @Nonnull final Float defaultValue, @Nonnull final Predicate<? super Float> filter) {
0883         requireNonNull(items, ERROR_ITEMS_NULL);
0884         requireNonNull(filter, ERROR_FILTER_NULL);
0885         return createFloatBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0886     }
0887 
0888     /**
0889      * Creates a float binding with the first element of an observable set after filtering.
0890      *
0891      @param items    the observable set of items.
0892      @param supplier a {@code Supplier} whose result is returned if no value is present.
0893      @param filter   a non-interfering, stateless predicate to apply to the each element.
0894      *
0895      @return a float binding
0896      */
0897     @Nonnull
0898     public static FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableSet<Float> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Predicate<? super Float> filter) {
0899         requireNonNull(items, ERROR_ITEMS_NULL);
0900         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0901         requireNonNull(filter, ERROR_FILTER_NULL);
0902         return createFloatBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0903     }
0904 
0905     /**
0906      * Creates a float binding with the first element of an observable set after filtering.
0907      *
0908      @param items        the observable set of items.
0909      @param defaultValue the value to be returned if there is no value present.
0910      @param filter       a non-interfering, stateless predicate to apply to the each element.
0911      *
0912      @return a float binding
0913      */
0914     @Nonnull
0915     public static FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableSet<Float> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Predicate<? super Float>> filter) {
0916         requireNonNull(items, ERROR_ITEMS_NULL);
0917         requireNonNull(filter, ERROR_FILTER_NULL);
0918         return createFloatBinding(() -> {
0919             Predicate<? super Float> filterValue = filter.getValue();
0920             requireNonNull(filterValue, ERROR_FILTER_NULL);
0921             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0922         }, items, filter);
0923     }
0924 
0925     /**
0926      * Creates a float binding with the first element of an observable set after filtering.
0927      *
0928      @param items    the observable set of items.
0929      @param supplier a {@code Supplier} whose result is returned if no value is present.
0930      @param filter   a non-interfering, stateless predicate to apply to the each element.
0931      *
0932      @return a float binding
0933      */
0934     @Nonnull
0935     public static FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableSet<Float> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Predicate<? super Float>> filter) {
0936         requireNonNull(items, ERROR_ITEMS_NULL);
0937         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0938         requireNonNull(filter, ERROR_FILTER_NULL);
0939         return createFloatBinding(() -> {
0940             Predicate<? super Float> filterValue = filter.getValue();
0941             requireNonNull(filterValue, ERROR_FILTER_NULL);
0942             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
0943         }, items, filter);
0944     }
0945 
0946     /**
0947      * Creates a double binding with the first element of an observable set after filtering.
0948      *
0949      @param items        the observable set of items.
0950      @param defaultValue the value to be returned if there is no value present.
0951      @param filter       a non-interfering, stateless predicate to apply to the each element.
0952      *
0953      @return a double binding
0954      */
0955     @Nonnull
0956     public static DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableSet<Double> items, @Nonnull final Double defaultValue, @Nonnull final Predicate<? super Double> filter) {
0957         requireNonNull(items, ERROR_ITEMS_NULL);
0958         requireNonNull(filter, ERROR_FILTER_NULL);
0959         return createDoubleBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
0960     }
0961 
0962     /**
0963      * Creates a double binding with the first element of an observable set after filtering.
0964      *
0965      @param items    the observable set of items.
0966      @param supplier a {@code Supplier} whose result is returned if no value is present.
0967      @param filter   a non-interfering, stateless predicate to apply to the each element.
0968      *
0969      @return a double binding
0970      */
0971     @Nonnull
0972     public static DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableSet<Double> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Predicate<? super Double> filter) {
0973         requireNonNull(items, ERROR_ITEMS_NULL);
0974         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
0975         requireNonNull(filter, ERROR_FILTER_NULL);
0976         return createDoubleBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
0977     }
0978 
0979     /**
0980      * Creates a double binding with the first element of an observable set after filtering.
0981      *
0982      @param items        the observable set of items.
0983      @param defaultValue the value to be returned if there is no value present.
0984      @param filter       a non-interfering, stateless predicate to apply to the each element.
0985      *
0986      @return a double binding
0987      */
0988     @Nonnull
0989     public static DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableSet<Double> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Predicate<? super Double>> filter) {
0990         requireNonNull(items, ERROR_ITEMS_NULL);
0991         requireNonNull(filter, ERROR_FILTER_NULL);
0992         return createDoubleBinding(() -> {
0993             Predicate<? super Double> filterValue = filter.getValue();
0994             requireNonNull(filterValue, ERROR_FILTER_NULL);
0995             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
0996         }, items, filter);
0997     }
0998 
0999     /**
1000      * Creates a double binding with the first element of an observable set after filtering.
1001      *
1002      @param items    the observable set of items.
1003      @param supplier a {@code Supplier} whose result is returned if no value is present.
1004      @param filter   a non-interfering, stateless predicate to apply to the each element.
1005      *
1006      @return a double binding
1007      */
1008     @Nonnull
1009     public static DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableSet<Double> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Predicate<? super Double>> filter) {
1010         requireNonNull(items, ERROR_ITEMS_NULL);
1011         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1012         requireNonNull(filter, ERROR_FILTER_NULL);
1013         return createDoubleBinding(() -> {
1014             Predicate<? super Double> filterValue = filter.getValue();
1015             requireNonNull(filterValue, ERROR_FILTER_NULL);
1016             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
1017         }, items, filter);
1018     }
1019 
1020     /**
1021      * Creates a string binding with the first element of an observable set after filtering.
1022      *
1023      @param items        the observable set of items.
1024      @param defaultValue the value to be returned if there is no value present.
1025      @param filter       a non-interfering, stateless predicate to apply to the each element.
1026      *
1027      @return a string binding
1028      */
1029     @Nonnull
1030     public static StringBinding filterThenFindFirstString(@Nonnull final ObservableSet<String> items, @Nonnull final String defaultValue, @Nonnull final Predicate<? super String> filter) {
1031         requireNonNull(items, ERROR_ITEMS_NULL);
1032         requireNonNull(filter, ERROR_FILTER_NULL);
1033         return createStringBinding(() -> items.stream().filter(filter).findFirst().orElse(defaultValue), items);
1034     }
1035 
1036     /**
1037      * Creates a string binding with the first element of an observable set after filtering.
1038      *
1039      @param items    the observable set of items.
1040      @param supplier a {@code Supplier} whose result is returned if no value is present.
1041      @param filter   a non-interfering, stateless predicate to apply to the each element.
1042      *
1043      @return a string binding
1044      */
1045     @Nonnull
1046     public static StringBinding filterThenFindFirstString(@Nonnull final ObservableSet<String> items, @Nonnull final Supplier<String> supplier, @Nonnull final Predicate<? super String> filter) {
1047         requireNonNull(items, ERROR_ITEMS_NULL);
1048         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1049         requireNonNull(filter, ERROR_FILTER_NULL);
1050         return createStringBinding(() -> items.stream().filter(filter).findFirst().orElseGet(supplier), items);
1051     }
1052 
1053     /**
1054      * Creates a string binding with the first element of an observable set after filtering.
1055      *
1056      @param items        the observable set of items.
1057      @param defaultValue the value to be returned if there is no value present.
1058      @param filter       a non-interfering, stateless predicate to apply to the each element.
1059      *
1060      @return a string binding
1061      */
1062     @Nonnull
1063     public static StringBinding filterThenFindFirstString(@Nonnull final ObservableSet<String> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Predicate<? super String>> filter) {
1064         requireNonNull(items, ERROR_ITEMS_NULL);
1065         requireNonNull(filter, ERROR_FILTER_NULL);
1066         return createStringBinding(() -> {
1067             Predicate<? super String> filterValue = filter.getValue();
1068             requireNonNull(filterValue, ERROR_FILTER_NULL);
1069             return items.stream().filter(filterValue).findFirst().orElse(defaultValue);
1070         }, items, filter);
1071     }
1072 
1073     /**
1074      * Creates a string binding with the first element of an observable set after filtering.
1075      *
1076      @param items    the observable set of items.
1077      @param supplier a {@code Supplier} whose result is returned if no value is present.
1078      @param filter   a non-interfering, stateless predicate to apply to the each element.
1079      *
1080      @return a string binding
1081      */
1082     @Nonnull
1083     public static StringBinding filterThenFindFirstString(@Nonnull final ObservableSet<String> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Predicate<? super String>> filter) {
1084         requireNonNull(items, ERROR_ITEMS_NULL);
1085         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1086         requireNonNull(filter, ERROR_FILTER_NULL);
1087         return createStringBinding(() -> {
1088             Predicate<? super String> filterValue = filter.getValue();
1089             requireNonNull(filterValue, ERROR_FILTER_NULL);
1090             return items.stream().filter(filterValue).findFirst().orElseGet(supplier);
1091         }, items, filter);
1092     }
1093 
1094     /**
1095      * Creates an object binding with the first value of an observable map after filtering.
1096      *
1097      @param items        the observable map of items.
1098      @param defaultValue the value to be returned if there is no value present.
1099      @param filter       a non-interfering, stateless predicate to apply to the each value
1100      *
1101      @return an object binding
1102      */
1103     @Nonnull
1104     public static <K, V> ObjectBinding<V> filterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final V defaultValue, @Nonnull final Predicate<? super V> filter) {
1105         requireNonNull(items, ERROR_ITEMS_NULL);
1106         requireNonNull(filter, ERROR_FILTER_NULL);
1107         return createObjectBinding(() -> items.values().stream().filter(filter).findFirst().orElse(defaultValue), items);
1108     }
1109 
1110     /**
1111      * Creates an object binding with the first value of an observable map after filtering.
1112      *
1113      @param items    the observable map of items.
1114      @param supplier a {@code Supplier} whose result is returned if no value is present.
1115      @param filter   a non-interfering, stateless predicate to apply to the each value
1116      *
1117      @return an object binding
1118      */
1119     @Nonnull
1120     public static <K, V> ObjectBinding<V> filterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<V> supplier, @Nonnull final Predicate<? super V> filter) {
1121         requireNonNull(items, ERROR_ITEMS_NULL);
1122         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1123         requireNonNull(filter, ERROR_FILTER_NULL);
1124         return createObjectBinding(() -> items.values().stream().filter(filter).findFirst().orElseGet(supplier), items);
1125     }
1126 
1127     /**
1128      * Creates an object binding with the first value of an observable map after filtering.
1129      *
1130      @param items        the observable map of items.
1131      @param defaultValue the value to be returned if there is no value present.
1132      @param filter       a non-interfering, stateless predicate to apply to the each value
1133      *
1134      @return an object binding
1135      */
1136     @Nonnull
1137     public static <K, V> ObjectBinding<V> filterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final V defaultValue, @Nonnull final ObservableValue<Predicate<? super V>> filter) {
1138         requireNonNull(items, ERROR_ITEMS_NULL);
1139         requireNonNull(filter, ERROR_FILTER_NULL);
1140         return createObjectBinding(() -> {
1141             Predicate<? super V> filterValue = filter.getValue();
1142             requireNonNull(filterValue, ERROR_FILTER_NULL);
1143             return items.values().stream().filter(filterValue).findFirst().orElse(defaultValue);
1144         }, items, filter);
1145     }
1146 
1147     /**
1148      * Creates an object binding with the first value of an observable map after filtering.
1149      *
1150      @param items    the observable map of items.
1151      @param supplier a {@code Supplier} whose result is returned if no value is present.
1152      @param filter   a non-interfering, stateless predicate to apply to the each value
1153      *
1154      @return an object binding
1155      */
1156     @Nonnull
1157     public static <K, V> ObjectBinding<V> filterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<V> supplier, @Nonnull final ObservableValue<Predicate<? super V>> filter) {
1158         requireNonNull(items, ERROR_ITEMS_NULL);
1159         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1160         requireNonNull(filter, ERROR_FILTER_NULL);
1161         return createObjectBinding(() -> {
1162             Predicate<? super V> filterValue = filter.getValue();
1163             requireNonNull(filterValue, ERROR_FILTER_NULL);
1164             return items.values().stream().filter(filterValue).findFirst().orElseGet(supplier);
1165         }, items, filter);
1166     }
1167 
1168     /**
1169      * Creates a boolean binding with the first value of an observable map after filtering.
1170      *
1171      @param items        the observable map of items.
1172      @param defaultValue the value to be returned if there is no value present.
1173      @param filter       a non-interfering, stateless predicate to apply to the each value
1174      *
1175      @return a boolean binding
1176      */
1177     @Nonnull
1178     public static <K> BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableMap<K, Boolean> items, @Nonnull final Boolean defaultValue, @Nonnull final Predicate<? super Boolean> filter) {
1179         requireNonNull(items, ERROR_ITEMS_NULL);
1180         requireNonNull(filter, ERROR_FILTER_NULL);
1181         return createBooleanBinding(() -> items.values().stream().filter(filter).findFirst().orElse(defaultValue), items);
1182     }
1183 
1184     /**
1185      * Creates a boolean binding with the first value of an observable map after filtering.
1186      *
1187      @param items    the observable map of items.
1188      @param supplier a {@code Supplier} whose result is returned if no value is present.
1189      @param filter   a non-interfering, stateless predicate to apply to the each value
1190      *
1191      @return a boolean binding
1192      */
1193     @Nonnull
1194     public static <K> BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableMap<K, Boolean> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Predicate<? super Boolean> filter) {
1195         requireNonNull(items, ERROR_ITEMS_NULL);
1196         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1197         requireNonNull(filter, ERROR_FILTER_NULL);
1198         return createBooleanBinding(() -> items.values().stream().filter(filter).findFirst().orElseGet(supplier), items);
1199     }
1200 
1201     /**
1202      * Creates a boolean binding with the first value of an observable map after filtering.
1203      *
1204      @param items        the observable map of items.
1205      @param defaultValue the value to be returned if there is no value present.
1206      @param filter       a non-interfering, stateless predicate to apply to the each value
1207      *
1208      @return a boolean binding
1209      */
1210     @Nonnull
1211     public static <K> BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableMap<K, Boolean> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Predicate<? super Boolean>> filter) {
1212         requireNonNull(items, ERROR_ITEMS_NULL);
1213         requireNonNull(filter, ERROR_FILTER_NULL);
1214         return createBooleanBinding(() -> {
1215             Predicate<? super Boolean> filterValue = filter.getValue();
1216             requireNonNull(filterValue, ERROR_FILTER_NULL);
1217             return items.values().stream().filter(filterValue).findFirst().orElse(defaultValue);
1218         }, items, filter);
1219     }
1220 
1221     /**
1222      * Creates a boolean binding with the first value of an observable map after filtering.
1223      *
1224      @param items    the observable map of items.
1225      @param supplier a {@code Supplier} whose result is returned if no value is present.
1226      @param filter   a non-interfering, stateless predicate to apply to the each value
1227      *
1228      @return a boolean binding
1229      */
1230     @Nonnull
1231     public static <K> BooleanBinding filterThenFindFirstBoolean(@Nonnull final ObservableMap<K, Boolean> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Predicate<? super Boolean>> filter) {
1232         requireNonNull(items, ERROR_ITEMS_NULL);
1233         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1234         requireNonNull(filter, ERROR_FILTER_NULL);
1235         return createBooleanBinding(() -> {
1236             Predicate<? super Boolean> filterValue = filter.getValue();
1237             requireNonNull(filterValue, ERROR_FILTER_NULL);
1238             return items.values().stream().filter(filterValue).findFirst().orElseGet(supplier);
1239         }, items, filter);
1240     }
1241 
1242     /**
1243      * Creates an integer binding with the first value of an observable map after filtering.
1244      *
1245      @param items        the observable map of items.
1246      @param defaultValue the value to be returned if there is no value present.
1247      @param filter       a non-interfering, stateless predicate to apply to the each value
1248      *
1249      @return an integer binding
1250      */
1251     @Nonnull
1252     public static <K> IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableMap<K, Integer> items, @Nonnull final Integer defaultValue, @Nonnull final Predicate<? super Integer> filter) {
1253         requireNonNull(items, ERROR_ITEMS_NULL);
1254         requireNonNull(filter, ERROR_FILTER_NULL);
1255         return createIntegerBinding(() -> items.values().stream().filter(filter).findFirst().orElse(defaultValue), items);
1256     }
1257 
1258     /**
1259      * Creates an integer binding with the first value of an observable map after filtering.
1260      *
1261      @param items    the observable map of items.
1262      @param supplier a {@code Supplier} whose result is returned if no value is present.
1263      @param filter   a non-interfering, stateless predicate to apply to the each value
1264      *
1265      @return an integer binding
1266      */
1267     @Nonnull
1268     public static <K> IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableMap<K, Integer> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Predicate<? super Integer> filter) {
1269         requireNonNull(items, ERROR_ITEMS_NULL);
1270         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1271         requireNonNull(filter, ERROR_FILTER_NULL);
1272         return createIntegerBinding(() -> items.values().stream().filter(filter).findFirst().orElseGet(supplier), items);
1273     }
1274 
1275     /**
1276      * Creates an integer binding with the first value of an observable map after filtering.
1277      *
1278      @param items        the observable map of items.
1279      @param defaultValue the value to be returned if there is no value present.
1280      @param filter       a non-interfering, stateless predicate to apply to the each value
1281      *
1282      @return an integer binding
1283      */
1284     @Nonnull
1285     public static <K> IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableMap<K, Integer> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Predicate<? super Integer>> filter) {
1286         requireNonNull(items, ERROR_ITEMS_NULL);
1287         requireNonNull(filter, ERROR_FILTER_NULL);
1288         return createIntegerBinding(() -> {
1289             Predicate<? super Integer> filterValue = filter.getValue();
1290             requireNonNull(filterValue, ERROR_FILTER_NULL);
1291             return items.values().stream().filter(filterValue).findFirst().orElse(defaultValue);
1292         }, items, filter);
1293     }
1294 
1295     /**
1296      * Creates an integer binding with the first value of an observable map after filtering.
1297      *
1298      @param items    the observable map of items.
1299      @param supplier a {@code Supplier} whose result is returned if no value is present.
1300      @param filter   a non-interfering, stateless predicate to apply to the each value
1301      *
1302      @return an integer binding
1303      */
1304     @Nonnull
1305     public static <K> IntegerBinding filterThenFindFirstInteger(@Nonnull final ObservableMap<K, Integer> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Predicate<? super Integer>> filter) {
1306         requireNonNull(items, ERROR_ITEMS_NULL);
1307         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1308         requireNonNull(filter, ERROR_FILTER_NULL);
1309         return createIntegerBinding(() -> {
1310             Predicate<? super Integer> filterValue = filter.getValue();
1311             requireNonNull(filterValue, ERROR_FILTER_NULL);
1312             return items.values().stream().filter(filterValue).findFirst().orElseGet(supplier);
1313         }, items, filter);
1314     }
1315 
1316     /**
1317      * Creates a long binding with the first value of an observable map after filtering.
1318      *
1319      @param items        the observable map of items.
1320      @param defaultValue the value to be returned if there is no value present.
1321      @param filter       a non-interfering, stateless predicate to apply to the each value
1322      *
1323      @return a long binding
1324      */
1325     @Nonnull
1326     public static <K> LongBinding filterThenFindFirstLong(@Nonnull final ObservableMap<K, Long> items, @Nonnull final Long defaultValue, @Nonnull final Predicate<? super Long> filter) {
1327         requireNonNull(items, ERROR_ITEMS_NULL);
1328         requireNonNull(filter, ERROR_FILTER_NULL);
1329         return createLongBinding(() -> items.values().stream().filter(filter).findFirst().orElse(defaultValue), items);
1330     }
1331 
1332     /**
1333      * Creates a long binding with the first value of an observable map after filtering.
1334      *
1335      @param items    the observable map of items.
1336      @param supplier a {@code Supplier} whose result is returned if no value is present.
1337      @param filter   a non-interfering, stateless predicate to apply to the each value
1338      *
1339      @return a long binding
1340      */
1341     @Nonnull
1342     public static <K> LongBinding filterThenFindFirstLong(@Nonnull final ObservableMap<K, Long> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Predicate<? super Long> filter) {
1343         requireNonNull(items, ERROR_ITEMS_NULL);
1344         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1345         requireNonNull(filter, ERROR_FILTER_NULL);
1346         return createLongBinding(() -> items.values().stream().filter(filter).findFirst().orElseGet(supplier), items);
1347     }
1348 
1349     /**
1350      * Creates a long binding with the first value of an observable map after filtering.
1351      *
1352      @param items        the observable map of items.
1353      @param defaultValue the value to be returned if there is no value present.
1354      @param filter       a non-interfering, stateless predicate to apply to the each value
1355      *
1356      @return a long binding
1357      */
1358     @Nonnull
1359     public static <K> LongBinding filterThenFindFirstLong(@Nonnull final ObservableMap<K, Long> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Predicate<? super Long>> filter) {
1360         requireNonNull(items, ERROR_ITEMS_NULL);
1361         requireNonNull(filter, ERROR_FILTER_NULL);
1362         return createLongBinding(() -> {
1363             Predicate<? super Long> filterValue = filter.getValue();
1364             requireNonNull(filterValue, ERROR_FILTER_NULL);
1365             return items.values().stream().filter(filterValue).findFirst().orElse(defaultValue);
1366         }, items, filter);
1367     }
1368 
1369     /**
1370      * Creates a long binding with the first value of an observable map after filtering.
1371      *
1372      @param items    the observable map of items.
1373      @param supplier a {@code Supplier} whose result is returned if no value is present.
1374      @param filter   a non-interfering, stateless predicate to apply to the each value
1375      *
1376      @return a long binding
1377      */
1378     @Nonnull
1379     public static <K> LongBinding filterThenFindFirstLong(@Nonnull final ObservableMap<K, Long> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Predicate<? super Long>> filter) {
1380         requireNonNull(items, ERROR_ITEMS_NULL);
1381         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1382         requireNonNull(filter, ERROR_FILTER_NULL);
1383         return createLongBinding(() -> {
1384             Predicate<? super Long> filterValue = filter.getValue();
1385             requireNonNull(filterValue, ERROR_FILTER_NULL);
1386             return items.values().stream().filter(filterValue).findFirst().orElseGet(supplier);
1387         }, items, filter);
1388     }
1389 
1390     /**
1391      * Creates a float binding with the first value of an observable map after filtering.
1392      *
1393      @param items        the observable map of items.
1394      @param defaultValue the value to be returned if there is no value present.
1395      @param filter       a non-interfering, stateless predicate to apply to the each value
1396      *
1397      @return a float binding
1398      */
1399     @Nonnull
1400     public static <K> FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableMap<K, Float> items, @Nonnull final Float defaultValue, @Nonnull final Predicate<? super Float> filter) {
1401         requireNonNull(items, ERROR_ITEMS_NULL);
1402         requireNonNull(filter, ERROR_FILTER_NULL);
1403         return createFloatBinding(() -> items.values().stream().filter(filter).findFirst().orElse(defaultValue), items);
1404     }
1405 
1406     /**
1407      * Creates a float binding with the first value of an observable map after filtering.
1408      *
1409      @param items    the observable map of items.
1410      @param supplier a {@code Supplier} whose result is returned if no value is present.
1411      @param filter   a non-interfering, stateless predicate to apply to the each value
1412      *
1413      @return a float binding
1414      */
1415     @Nonnull
1416     public static <K> FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableMap<K, Float> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Predicate<? super Float> filter) {
1417         requireNonNull(items, ERROR_ITEMS_NULL);
1418         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1419         requireNonNull(filter, ERROR_FILTER_NULL);
1420         return createFloatBinding(() -> items.values().stream().filter(filter).findFirst().orElseGet(supplier), items);
1421     }
1422 
1423     /**
1424      * Creates a float binding with the first value of an observable map after filtering.
1425      *
1426      @param items        the observable map of items.
1427      @param defaultValue the value to be returned if there is no value present.
1428      @param filter       a non-interfering, stateless predicate to apply to the each value
1429      *
1430      @return a float binding
1431      */
1432     @Nonnull
1433     public static <K> FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableMap<K, Float> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Predicate<? super Float>> filter) {
1434         requireNonNull(items, ERROR_ITEMS_NULL);
1435         requireNonNull(filter, ERROR_FILTER_NULL);
1436         return createFloatBinding(() -> {
1437             Predicate<? super Float> filterValue = filter.getValue();
1438             requireNonNull(filterValue, ERROR_FILTER_NULL);
1439             return items.values().stream().filter(filterValue).findFirst().orElse(defaultValue);
1440         }, items, filter);
1441     }
1442 
1443     /**
1444      * Creates a float binding with the first value of an observable map after filtering.
1445      *
1446      @param items    the observable map of items.
1447      @param supplier a {@code Supplier} whose result is returned if no value is present.
1448      @param filter   a non-interfering, stateless predicate to apply to the each value
1449      *
1450      @return a float binding
1451      */
1452     @Nonnull
1453     public static <K> FloatBinding filterThenFindFirstFloat(@Nonnull final ObservableMap<K, Float> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Predicate<? super Float>> filter) {
1454         requireNonNull(items, ERROR_ITEMS_NULL);
1455         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1456         requireNonNull(filter, ERROR_FILTER_NULL);
1457         return createFloatBinding(() -> {
1458             Predicate<? super Float> filterValue = filter.getValue();
1459             requireNonNull(filterValue, ERROR_FILTER_NULL);
1460             return items.values().stream().filter(filterValue).findFirst().orElseGet(supplier);
1461         }, items, filter);
1462     }
1463 
1464     /**
1465      * Creates a double binding with the first value of an observable map after filtering.
1466      *
1467      @param items        the observable map of items.
1468      @param defaultValue the value to be returned if there is no value present.
1469      @param filter       a non-interfering, stateless predicate to apply to the each value
1470      *
1471      @return a double binding
1472      */
1473     @Nonnull
1474     public static <K> DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableMap<K, Double> items, @Nonnull final Double defaultValue, @Nonnull final Predicate<? super Double> filter) {
1475         requireNonNull(items, ERROR_ITEMS_NULL);
1476         requireNonNull(filter, ERROR_FILTER_NULL);
1477         return createDoubleBinding(() -> items.values().stream().filter(filter).findFirst().orElse(defaultValue), items);
1478     }
1479 
1480     /**
1481      * Creates a double binding with the first value of an observable map after filtering.
1482      *
1483      @param items    the observable map of items.
1484      @param supplier a {@code Supplier} whose result is returned if no value is present.
1485      @param filter   a non-interfering, stateless predicate to apply to the each value
1486      *
1487      @return a double binding
1488      */
1489     @Nonnull
1490     public static <K> DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableMap<K, Double> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Predicate<? super Double> filter) {
1491         requireNonNull(items, ERROR_ITEMS_NULL);
1492         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1493         requireNonNull(filter, ERROR_FILTER_NULL);
1494         return createDoubleBinding(() -> items.values().stream().filter(filter).findFirst().orElseGet(supplier), items);
1495     }
1496 
1497     /**
1498      * Creates a double binding with the first value of an observable map after filtering.
1499      *
1500      @param items        the observable map of items.
1501      @param defaultValue the value to be returned if there is no value present.
1502      @param filter       a non-interfering, stateless predicate to apply to the each value
1503      *
1504      @return a double binding
1505      */
1506     @Nonnull
1507     public static <K> DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableMap<K, Double> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Predicate<? super Double>> filter) {
1508         requireNonNull(items, ERROR_ITEMS_NULL);
1509         requireNonNull(filter, ERROR_FILTER_NULL);
1510         return createDoubleBinding(() -> {
1511             Predicate<? super Double> filterValue = filter.getValue();
1512             requireNonNull(filterValue, ERROR_FILTER_NULL);
1513             return items.values().stream().filter(filterValue).findFirst().orElse(defaultValue);
1514         }, items, filter);
1515     }
1516 
1517     /**
1518      * Creates a double binding with the first value of an observable map after filtering.
1519      *
1520      @param items    the observable map of items.
1521      @param supplier a {@code Supplier} whose result is returned if no value is present.
1522      @param filter   a non-interfering, stateless predicate to apply to the each value
1523      *
1524      @return a double binding
1525      */
1526     @Nonnull
1527     public static <K> DoubleBinding filterThenFindFirstDouble(@Nonnull final ObservableMap<K, Double> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Predicate<? super Double>> filter) {
1528         requireNonNull(items, ERROR_ITEMS_NULL);
1529         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1530         requireNonNull(filter, ERROR_FILTER_NULL);
1531         return createDoubleBinding(() -> {
1532             Predicate<? super Double> filterValue = filter.getValue();
1533             requireNonNull(filterValue, ERROR_FILTER_NULL);
1534             return items.values().stream().filter(filterValue).findFirst().orElseGet(supplier);
1535         }, items, filter);
1536     }
1537 
1538     /**
1539      * Creates a string binding with the first value of an observable map after filtering.
1540      *
1541      @param items        the observable map of items.
1542      @param defaultValue the value to be returned if there is no value present.
1543      @param filter       a non-interfering, stateless predicate to apply to the each value
1544      *
1545      @return a string binding
1546      */
1547     @Nonnull
1548     public static <K> StringBinding filterThenFindFirstString(@Nonnull final ObservableMap<K, String> items, @Nonnull final String defaultValue, @Nonnull final Predicate<? super String> filter) {
1549         requireNonNull(items, ERROR_ITEMS_NULL);
1550         requireNonNull(filter, ERROR_FILTER_NULL);
1551         return createStringBinding(() -> items.values().stream().filter(filter).findFirst().orElse(defaultValue), items);
1552     }
1553 
1554     /**
1555      * Creates a string binding with the first value of an observable map after filtering.
1556      *
1557      @param items    the observable map of items.
1558      @param supplier a {@code Supplier} whose result is returned if no value is present.
1559      @param filter   a non-interfering, stateless predicate to apply to the each value
1560      *
1561      @return a string binding
1562      */
1563     @Nonnull
1564     public static <K> StringBinding filterThenFindFirstString(@Nonnull final ObservableMap<K, String> items, @Nonnull final Supplier<String> supplier, @Nonnull final Predicate<? super String> filter) {
1565         requireNonNull(items, ERROR_ITEMS_NULL);
1566         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1567         requireNonNull(filter, ERROR_FILTER_NULL);
1568         return createStringBinding(() -> items.values().stream().filter(filter).findFirst().orElseGet(supplier), items);
1569     }
1570 
1571     /**
1572      * Creates a string binding with the first value of an observable map after filtering.
1573      *
1574      @param items        the observable map of items.
1575      @param defaultValue the value to be returned if there is no value present.
1576      @param filter       a non-interfering, stateless predicate to apply to the each value
1577      *
1578      @return a string binding
1579      */
1580     @Nonnull
1581     public static <K> StringBinding filterThenFindFirstString(@Nonnull final ObservableMap<K, String> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Predicate<? super String>> filter) {
1582         requireNonNull(items, ERROR_ITEMS_NULL);
1583         requireNonNull(filter, ERROR_FILTER_NULL);
1584         return createStringBinding(() -> {
1585             Predicate<? super String> filterValue = filter.getValue();
1586             requireNonNull(filterValue, ERROR_FILTER_NULL);
1587             return items.values().stream().filter(filterValue).findFirst().orElse(defaultValue);
1588         }, items, filter);
1589     }
1590 
1591     /**
1592      * Creates a string binding with the first value of an observable map after filtering.
1593      *
1594      @param items    the observable map of items.
1595      @param supplier a {@code Supplier} whose result is returned if no value is present.
1596      @param filter   a non-interfering, stateless predicate to apply to the each value
1597      *
1598      @return a string binding
1599      */
1600     @Nonnull
1601     public static <K> StringBinding filterThenFindFirstString(@Nonnull final ObservableMap<K, String> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Predicate<? super String>> filter) {
1602         requireNonNull(items, ERROR_ITEMS_NULL);
1603         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1604         requireNonNull(filter, ERROR_FILTER_NULL);
1605         return createStringBinding(() -> {
1606             Predicate<? super String> filterValue = filter.getValue();
1607             requireNonNull(filterValue, ERROR_FILTER_NULL);
1608             return items.values().stream().filter(filterValue).findFirst().orElseGet(supplier);
1609         }, items, filter);
1610     }
1611 
1612     /**
1613      * Creates an object binding with the first element of an observable list after mapping and filtering.
1614      *
1615      @param items        the observable list of items.
1616      @param defaultValue the value to be returned if there is no value present.
1617      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1618      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1619      *
1620      @return an object binding
1621      */
1622     @Nonnull
1623     public static <T, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final R defaultValue, @Nonnull final Function<? super T, R> mapper, @Nonnull final Predicate<? super R> filter) {
1624         requireNonNull(items, ERROR_ITEMS_NULL);
1625         requireNonNull(mapper, ERROR_MAPPER_NULL);
1626         requireNonNull(filter, ERROR_FILTER_NULL);
1627         return createObjectBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
1628     }
1629 
1630     /**
1631      * Creates an object binding with the first element of an observable list after mapping and filtering.
1632      *
1633      @param items    the observable list of items.
1634      @param supplier a {@code Supplier} whose result is returned if no value is present.
1635      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1636      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1637      *
1638      @return an object binding
1639      */
1640     @Nonnull
1641     public static <T, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<R> supplier, @Nonnull final Function<? super T, R> mapper, @Nonnull final Predicate<? super R> filter) {
1642         requireNonNull(items, ERROR_ITEMS_NULL);
1643         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1644         requireNonNull(mapper, ERROR_MAPPER_NULL);
1645         requireNonNull(filter, ERROR_FILTER_NULL);
1646         return createObjectBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
1647     }
1648 
1649     /**
1650      * Creates an object binding with the first element of an observable list after mapping and filtering.
1651      *
1652      @param items        the observable list of items.
1653      @param defaultValue the value to be returned if there is no value present.
1654      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1655      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1656      *
1657      @return an object binding
1658      */
1659     @Nonnull
1660     public static <T, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final R defaultValue, @Nonnull final ObservableValue<Function<? super T, R>> mapper, @Nonnull final ObservableValue<Predicate<? super R>> filter) {
1661         requireNonNull(items, ERROR_ITEMS_NULL);
1662         requireNonNull(mapper, ERROR_MAPPER_NULL);
1663         requireNonNull(filter, ERROR_FILTER_NULL);
1664         return createObjectBinding(() -> {
1665             Function<? super T, R> mapperValue = mapper.getValue();
1666             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
1667             Predicate<? super R> filterValue = filter.getValue();
1668             requireNonNull(filterValue, ERROR_FILTER_NULL);
1669             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
1670         }, items, mapper, filter);
1671     }
1672 
1673     /**
1674      * Creates an object binding with the first element of an observable list after mapping and filtering.
1675      *
1676      @param items    the observable list of items.
1677      @param supplier a {@code Supplier} whose result is returned if no value is present.
1678      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1679      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1680      *
1681      @return an object binding
1682      */
1683     @Nonnull
1684     public static <T, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<R> supplier, @Nonnull final ObservableValue<Function<? super T, R>> mapper, @Nonnull final ObservableValue<Predicate<? super R>> filter) {
1685         requireNonNull(items, ERROR_ITEMS_NULL);
1686         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1687         requireNonNull(mapper, ERROR_MAPPER_NULL);
1688         requireNonNull(filter, ERROR_FILTER_NULL);
1689         return createObjectBinding(() -> {
1690             Function<? super T, R> mapperValue = mapper.getValue();
1691             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
1692             Predicate<? super R> filterValue = filter.getValue();
1693             requireNonNull(filterValue, ERROR_FILTER_NULL);
1694             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
1695         }, items, mapper, filter);
1696     }
1697 
1698     /**
1699      * Creates a boolean binding with the first element of an observable list after mapping and filtering.
1700      *
1701      @param items        the observable list of items.
1702      @param defaultValue the value to be returned if there is no value present.
1703      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1704      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1705      *
1706      @return a boolean binding
1707      */
1708     @Nonnull
1709     public static <T> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Boolean defaultValue, @Nonnull final Function<? super T, Boolean> mapper, @Nonnull final Predicate<Boolean> filter) {
1710         requireNonNull(items, ERROR_ITEMS_NULL);
1711         requireNonNull(mapper, ERROR_MAPPER_NULL);
1712         requireNonNull(filter, ERROR_FILTER_NULL);
1713         return createBooleanBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
1714     }
1715 
1716     /**
1717      * Creates a boolean binding with the first element of an observable list after mapping and filtering.
1718      *
1719      @param items    the observable list of items.
1720      @param supplier a {@code Supplier} whose result is returned if no value is present.
1721      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1722      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1723      *
1724      @return a boolean binding
1725      */
1726     @Nonnull
1727     public static <T> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Function<? super T, Boolean> mapper, @Nonnull final Predicate<Boolean> filter) {
1728         requireNonNull(items, ERROR_ITEMS_NULL);
1729         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1730         requireNonNull(mapper, ERROR_MAPPER_NULL);
1731         requireNonNull(filter, ERROR_FILTER_NULL);
1732         return createBooleanBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
1733     }
1734 
1735     /**
1736      * Creates a boolean binding with the first element of an observable list after mapping and filtering.
1737      *
1738      @param items        the observable list of items.
1739      @param defaultValue the value to be returned if there is no value present.
1740      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1741      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1742      *
1743      @return a boolean binding
1744      */
1745     @Nonnull
1746     public static <T> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Function<? super T, Boolean>> mapper, @Nonnull final ObservableValue<Predicate<Boolean>> filter) {
1747         requireNonNull(items, ERROR_ITEMS_NULL);
1748         requireNonNull(mapper, ERROR_MAPPER_NULL);
1749         requireNonNull(filter, ERROR_FILTER_NULL);
1750         return createBooleanBinding(() -> {
1751             Function<? super T, Boolean> mapperValue = mapper.getValue();
1752             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
1753             Predicate<Boolean> filterValue = filter.getValue();
1754             requireNonNull(filterValue, ERROR_FILTER_NULL);
1755             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
1756         }, items, mapper, filter);
1757     }
1758 
1759     /**
1760      * Creates a boolean binding with the first element of an observable list after mapping and filtering.
1761      *
1762      @param items    the observable list of items.
1763      @param supplier a {@code Supplier} whose result is returned if no value is present.
1764      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1765      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1766      *
1767      @return a boolean binding
1768      */
1769     @Nonnull
1770     public static <T> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Function<? super T, Boolean>> mapper, @Nonnull final ObservableValue<Predicate<Boolean>> filter) {
1771         requireNonNull(items, ERROR_ITEMS_NULL);
1772         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1773         requireNonNull(mapper, ERROR_MAPPER_NULL);
1774         requireNonNull(filter, ERROR_FILTER_NULL);
1775         return createBooleanBinding(() -> {
1776             Function<? super T, Boolean> mapperValue = mapper.getValue();
1777             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
1778             Predicate<Boolean> filterValue = filter.getValue();
1779             requireNonNull(filterValue, ERROR_FILTER_NULL);
1780             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
1781         }, items, mapper, filter);
1782     }
1783 
1784     /**
1785      * Creates an integer binding with the first element of an observable list after mapping and filtering.
1786      *
1787      @param items        the observable list of items.
1788      @param defaultValue the value to be returned if there is no value present.
1789      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1790      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1791      *
1792      @return an integer binding
1793      */
1794     @Nonnull
1795     public static <T> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Integer defaultValue, @Nonnull final Function<? super T, Integer> mapper, @Nonnull final Predicate<Integer> filter) {
1796         requireNonNull(items, ERROR_ITEMS_NULL);
1797         requireNonNull(mapper, ERROR_MAPPER_NULL);
1798         requireNonNull(filter, ERROR_FILTER_NULL);
1799         return createIntegerBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
1800     }
1801 
1802     /**
1803      * Creates an integer binding with the first element of an observable list after mapping and filtering.
1804      *
1805      @param items    the observable list of items.
1806      @param supplier a {@code Supplier} whose result is returned if no value is present.
1807      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1808      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1809      *
1810      @return an integer binding
1811      */
1812     @Nonnull
1813     public static <T> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Function<? super T, Integer> mapper, @Nonnull final Predicate<Integer> filter) {
1814         requireNonNull(items, ERROR_ITEMS_NULL);
1815         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1816         requireNonNull(mapper, ERROR_MAPPER_NULL);
1817         requireNonNull(filter, ERROR_FILTER_NULL);
1818         return createIntegerBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
1819     }
1820 
1821     /**
1822      * Creates an integer binding with the first element of an observable list after mapping and filtering.
1823      *
1824      @param items        the observable list of items.
1825      @param defaultValue the value to be returned if there is no value present.
1826      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1827      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1828      *
1829      @return an integer binding
1830      */
1831     @Nonnull
1832     public static <T> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Function<? super T, Integer>> mapper, @Nonnull final ObservableValue<Predicate<Integer>> filter) {
1833         requireNonNull(items, ERROR_ITEMS_NULL);
1834         requireNonNull(mapper, ERROR_MAPPER_NULL);
1835         requireNonNull(filter, ERROR_FILTER_NULL);
1836         return createIntegerBinding(() -> {
1837             Function<? super T, Integer> mapperValue = mapper.getValue();
1838             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
1839             Predicate<Integer> filterValue = filter.getValue();
1840             requireNonNull(filterValue, ERROR_FILTER_NULL);
1841             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
1842         }, items, mapper, filter);
1843     }
1844 
1845     /**
1846      * Creates an integer binding with the first element of an observable list after mapping and filtering.
1847      *
1848      @param items    the observable list of items.
1849      @param supplier a {@code Supplier} whose result is returned if no value is present.
1850      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1851      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1852      *
1853      @return an integer binding
1854      */
1855     @Nonnull
1856     public static <T> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Function<? super T, Integer>> mapper, @Nonnull final ObservableValue<Predicate<Integer>> filter) {
1857         requireNonNull(items, ERROR_ITEMS_NULL);
1858         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1859         requireNonNull(mapper, ERROR_MAPPER_NULL);
1860         requireNonNull(filter, ERROR_FILTER_NULL);
1861         return createIntegerBinding(() -> {
1862             Function<? super T, Integer> mapperValue = mapper.getValue();
1863             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
1864             Predicate<Integer> filterValue = filter.getValue();
1865             requireNonNull(filterValue, ERROR_FILTER_NULL);
1866             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
1867         }, items, mapper, filter);
1868     }
1869 
1870     /**
1871      * Creates a long binding with the first element of an observable list after mapping and filtering.
1872      *
1873      @param items        the observable list of items.
1874      @param defaultValue the value to be returned if there is no value present.
1875      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1876      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1877      *
1878      @return a long binding
1879      */
1880     @Nonnull
1881     public static <T> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Long defaultValue, @Nonnull final Function<? super T, Long> mapper, @Nonnull final Predicate<Long> filter) {
1882         requireNonNull(items, ERROR_ITEMS_NULL);
1883         requireNonNull(mapper, ERROR_MAPPER_NULL);
1884         requireNonNull(filter, ERROR_FILTER_NULL);
1885         return createLongBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
1886     }
1887 
1888     /**
1889      * Creates a long binding with the first element of an observable list after mapping and filtering.
1890      *
1891      @param items    the observable list of items.
1892      @param supplier a {@code Supplier} whose result is returned if no value is present.
1893      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1894      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1895      *
1896      @return a long binding
1897      */
1898     @Nonnull
1899     public static <T> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Function<? super T, Long> mapper, @Nonnull final Predicate<Long> filter) {
1900         requireNonNull(items, ERROR_ITEMS_NULL);
1901         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1902         requireNonNull(mapper, ERROR_MAPPER_NULL);
1903         requireNonNull(filter, ERROR_FILTER_NULL);
1904         return createLongBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
1905     }
1906 
1907     /**
1908      * Creates a long binding with the first element of an observable list after mapping and filtering.
1909      *
1910      @param items        the observable list of items.
1911      @param defaultValue the value to be returned if there is no value present.
1912      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1913      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1914      *
1915      @return a long binding
1916      */
1917     @Nonnull
1918     public static <T> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Function<? super T, Long>> mapper, @Nonnull final ObservableValue<Predicate<Long>> filter) {
1919         requireNonNull(items, ERROR_ITEMS_NULL);
1920         requireNonNull(mapper, ERROR_MAPPER_NULL);
1921         requireNonNull(filter, ERROR_FILTER_NULL);
1922         return createLongBinding(() -> {
1923             Function<? super T, Long> mapperValue = mapper.getValue();
1924             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
1925             Predicate<Long> filterValue = filter.getValue();
1926             requireNonNull(filterValue, ERROR_FILTER_NULL);
1927             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
1928         }, items, mapper, filter);
1929     }
1930 
1931     /**
1932      * Creates a long binding with the first element of an observable list after mapping and filtering.
1933      *
1934      @param items    the observable list of items.
1935      @param supplier a {@code Supplier} whose result is returned if no value is present.
1936      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1937      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1938      *
1939      @return a long binding
1940      */
1941     @Nonnull
1942     public static <T> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Function<? super T, Long>> mapper, @Nonnull final ObservableValue<Predicate<Long>> filter) {
1943         requireNonNull(items, ERROR_ITEMS_NULL);
1944         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1945         requireNonNull(mapper, ERROR_MAPPER_NULL);
1946         requireNonNull(filter, ERROR_FILTER_NULL);
1947         return createLongBinding(() -> {
1948             Function<? super T, Long> mapperValue = mapper.getValue();
1949             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
1950             Predicate<Long> filterValue = filter.getValue();
1951             requireNonNull(filterValue, ERROR_FILTER_NULL);
1952             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
1953         }, items, mapper, filter);
1954     }
1955 
1956     /**
1957      * Creates a float binding with the first element of an observable list after mapping and filtering.
1958      *
1959      @param items        the observable list of items.
1960      @param defaultValue the value to be returned if there is no value present.
1961      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1962      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
1963      *
1964      @return a float binding
1965      */
1966     @Nonnull
1967     public static <T> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Float defaultValue, @Nonnull final Function<? super T, Float> mapper, @Nonnull final Predicate<Float> filter) {
1968         requireNonNull(items, ERROR_ITEMS_NULL);
1969         requireNonNull(mapper, ERROR_MAPPER_NULL);
1970         requireNonNull(filter, ERROR_FILTER_NULL);
1971         return createFloatBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
1972     }
1973 
1974     /**
1975      * Creates a float binding with the first element of an observable list after mapping and filtering.
1976      *
1977      @param items    the observable list of items.
1978      @param supplier a {@code Supplier} whose result is returned if no value is present.
1979      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
1980      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
1981      *
1982      @return a float binding
1983      */
1984     @Nonnull
1985     public static <T> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Function<? super T, Float> mapper, @Nonnull final Predicate<Float> filter) {
1986         requireNonNull(items, ERROR_ITEMS_NULL);
1987         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
1988         requireNonNull(mapper, ERROR_MAPPER_NULL);
1989         requireNonNull(filter, ERROR_FILTER_NULL);
1990         return createFloatBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
1991     }
1992 
1993     /**
1994      * Creates a float binding with the first element of an observable list after mapping and filtering.
1995      *
1996      @param items        the observable list of items.
1997      @param defaultValue the value to be returned if there is no value present.
1998      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
1999      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2000      *
2001      @return a float binding
2002      */
2003     @Nonnull
2004     public static <T> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Function<? super T, Float>> mapper, @Nonnull final ObservableValue<Predicate<Float>> filter) {
2005         requireNonNull(items, ERROR_ITEMS_NULL);
2006         requireNonNull(mapper, ERROR_MAPPER_NULL);
2007         requireNonNull(filter, ERROR_FILTER_NULL);
2008         return createFloatBinding(() -> {
2009             Function<? super T, Float> mapperValue = mapper.getValue();
2010             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2011             Predicate<Float> filterValue = filter.getValue();
2012             requireNonNull(filterValue, ERROR_FILTER_NULL);
2013             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2014         }, items, mapper, filter);
2015     }
2016 
2017     /**
2018      * Creates a float binding with the first element of an observable list after mapping and filtering.
2019      *
2020      @param items    the observable list of items.
2021      @param supplier a {@code Supplier} whose result is returned if no value is present.
2022      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2023      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2024      *
2025      @return a float binding
2026      */
2027     @Nonnull
2028     public static <T> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Function<? super T, Float>> mapper, @Nonnull final ObservableValue<Predicate<Float>> filter) {
2029         requireNonNull(items, ERROR_ITEMS_NULL);
2030         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2031         requireNonNull(mapper, ERROR_MAPPER_NULL);
2032         requireNonNull(filter, ERROR_FILTER_NULL);
2033         return createFloatBinding(() -> {
2034             Function<? super T, Float> mapperValue = mapper.getValue();
2035             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2036             Predicate<Float> filterValue = filter.getValue();
2037             requireNonNull(filterValue, ERROR_FILTER_NULL);
2038             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2039         }, items, mapper, filter);
2040     }
2041 
2042     /**
2043      * Creates a double binding with the first element of an observable list after mapping and filtering.
2044      *
2045      @param items        the observable list of items.
2046      @param defaultValue the value to be returned if there is no value present.
2047      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2048      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2049      *
2050      @return a double binding
2051      */
2052     @Nonnull
2053     public static <T> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Double defaultValue, @Nonnull final Function<? super T, Double> mapper, @Nonnull final Predicate<Double> filter) {
2054         requireNonNull(items, ERROR_ITEMS_NULL);
2055         requireNonNull(mapper, ERROR_MAPPER_NULL);
2056         requireNonNull(filter, ERROR_FILTER_NULL);
2057         return createDoubleBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2058     }
2059 
2060     /**
2061      * Creates a double binding with the first element of an observable list after mapping and filtering.
2062      *
2063      @param items    the observable list of items.
2064      @param supplier a {@code Supplier} whose result is returned if no value is present.
2065      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2066      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2067      *
2068      @return a double binding
2069      */
2070     @Nonnull
2071     public static <T> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Function<? super T, Double> mapper, @Nonnull final Predicate<Double> filter) {
2072         requireNonNull(items, ERROR_ITEMS_NULL);
2073         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2074         requireNonNull(mapper, ERROR_MAPPER_NULL);
2075         requireNonNull(filter, ERROR_FILTER_NULL);
2076         return createDoubleBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2077     }
2078 
2079     /**
2080      * Creates a double binding with the first element of an observable list after mapping and filtering.
2081      *
2082      @param items        the observable list of items.
2083      @param defaultValue the value to be returned if there is no value present.
2084      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2085      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2086      *
2087      @return a double binding
2088      */
2089     @Nonnull
2090     public static <T> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Function<? super T, Double>> mapper, @Nonnull final ObservableValue<Predicate<Double>> filter) {
2091         requireNonNull(items, ERROR_ITEMS_NULL);
2092         requireNonNull(mapper, ERROR_MAPPER_NULL);
2093         requireNonNull(filter, ERROR_FILTER_NULL);
2094         return createDoubleBinding(() -> {
2095             Function<? super T, Double> mapperValue = mapper.getValue();
2096             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2097             Predicate<Double> filterValue = filter.getValue();
2098             requireNonNull(filterValue, ERROR_FILTER_NULL);
2099             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2100         }, items, mapper, filter);
2101     }
2102 
2103     /**
2104      * Creates a double binding with the first element of an observable list after mapping and filtering.
2105      *
2106      @param items    the observable list of items.
2107      @param supplier a {@code Supplier} whose result is returned if no value is present.
2108      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2109      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2110      *
2111      @return a double binding
2112      */
2113     @Nonnull
2114     public static <T> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Function<? super T, Double>> mapper, @Nonnull final ObservableValue<Predicate<Double>> filter) {
2115         requireNonNull(items, ERROR_ITEMS_NULL);
2116         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2117         requireNonNull(mapper, ERROR_MAPPER_NULL);
2118         requireNonNull(filter, ERROR_FILTER_NULL);
2119         return createDoubleBinding(() -> {
2120             Function<? super T, Double> mapperValue = mapper.getValue();
2121             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2122             Predicate<Double> filterValue = filter.getValue();
2123             requireNonNull(filterValue, ERROR_FILTER_NULL);
2124             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2125         }, items, mapper, filter);
2126     }
2127 
2128     /**
2129      * Creates a string binding with the first element of an observable list after mapping and filtering.
2130      *
2131      @param items        the observable list of items.
2132      @param defaultValue the value to be returned if there is no value present.
2133      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2134      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2135      *
2136      @return a string binding
2137      */
2138     @Nonnull
2139     public static <T> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final String defaultValue, @Nonnull final Function<? super T, String> mapper, @Nonnull final Predicate<String> filter) {
2140         requireNonNull(items, ERROR_ITEMS_NULL);
2141         requireNonNull(mapper, ERROR_MAPPER_NULL);
2142         requireNonNull(filter, ERROR_FILTER_NULL);
2143         return createStringBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2144     }
2145 
2146     /**
2147      * Creates a string binding with the first element of an observable list after mapping and filtering.
2148      *
2149      @param items    the observable list of items.
2150      @param supplier a {@code Supplier} whose result is returned if no value is present.
2151      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2152      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2153      *
2154      @return a string binding
2155      */
2156     @Nonnull
2157     public static <T> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<String> supplier, @Nonnull final Function<? super T, String> mapper, @Nonnull final Predicate<String> filter) {
2158         requireNonNull(items, ERROR_ITEMS_NULL);
2159         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2160         requireNonNull(mapper, ERROR_MAPPER_NULL);
2161         requireNonNull(filter, ERROR_FILTER_NULL);
2162         return createStringBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2163     }
2164 
2165     /**
2166      * Creates a string binding with the first element of an observable list after mapping and filtering.
2167      *
2168      @param items        the observable list of items.
2169      @param defaultValue the value to be returned if there is no value present.
2170      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2171      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2172      *
2173      @return a string binding
2174      */
2175     @Nonnull
2176     public static <T> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Function<? super T, String>> mapper, @Nonnull final ObservableValue<Predicate<String>> filter) {
2177         requireNonNull(items, ERROR_ITEMS_NULL);
2178         requireNonNull(mapper, ERROR_MAPPER_NULL);
2179         requireNonNull(filter, ERROR_FILTER_NULL);
2180         return createStringBinding(() -> {
2181             Function<? super T, String> mapperValue = mapper.getValue();
2182             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2183             Predicate<String> filterValue = filter.getValue();
2184             requireNonNull(filterValue, ERROR_FILTER_NULL);
2185             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2186         }, items, mapper, filter);
2187     }
2188 
2189     /**
2190      * Creates a string binding with the first element of an observable list after mapping and filtering.
2191      *
2192      @param items    the observable list of items.
2193      @param supplier a {@code Supplier} whose result is returned if no value is present.
2194      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2195      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2196      *
2197      @return a string binding
2198      */
2199     @Nonnull
2200     public static <T> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Function<? super T, String>> mapper, @Nonnull final ObservableValue<Predicate<String>> filter) {
2201         requireNonNull(items, ERROR_ITEMS_NULL);
2202         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2203         requireNonNull(mapper, ERROR_MAPPER_NULL);
2204         requireNonNull(filter, ERROR_FILTER_NULL);
2205         return createStringBinding(() -> {
2206             Function<? super T, String> mapperValue = mapper.getValue();
2207             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2208             Predicate<String> filterValue = filter.getValue();
2209             requireNonNull(filterValue, ERROR_FILTER_NULL);
2210             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2211         }, items, mapper, filter);
2212     }
2213 
2214     /**
2215      * Creates an object binding with the first element of an observable set after mapping and filtering.
2216      *
2217      @param items        the observable set of items.
2218      @param defaultValue the value to be returned if there is no value present.
2219      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2220      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2221      *
2222      @return an object binding
2223      */
2224     @Nonnull
2225     public static <T, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final R defaultValue, @Nonnull final Function<? super T, R> mapper, @Nonnull final Predicate<? super R> filter) {
2226         requireNonNull(items, ERROR_ITEMS_NULL);
2227         requireNonNull(mapper, ERROR_MAPPER_NULL);
2228         requireNonNull(filter, ERROR_FILTER_NULL);
2229         return createObjectBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2230     }
2231 
2232     /**
2233      * Creates an object binding with the first element of an observable set after mapping and filtering.
2234      *
2235      @param items    the observable set of items.
2236      @param supplier a {@code Supplier} whose result is returned if no value is present.
2237      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2238      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2239      *
2240      @return an object binding
2241      */
2242     @Nonnull
2243     public static <T, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<R> supplier, @Nonnull final Function<? super T, R> mapper, @Nonnull final Predicate<? super R> filter) {
2244         requireNonNull(items, ERROR_ITEMS_NULL);
2245         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2246         requireNonNull(mapper, ERROR_MAPPER_NULL);
2247         requireNonNull(filter, ERROR_FILTER_NULL);
2248         return createObjectBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2249     }
2250 
2251     /**
2252      * Creates an object binding with the first element of an observable set after mapping and filtering.
2253      *
2254      @param items        the observable set of items.
2255      @param defaultValue the value to be returned if there is no value present.
2256      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2257      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2258      *
2259      @return an object binding
2260      */
2261     @Nonnull
2262     public static <T, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final R defaultValue, @Nonnull final ObservableValue<Function<? super T, R>> mapper, @Nonnull final ObservableValue<Predicate<? super R>> filter) {
2263         requireNonNull(items, ERROR_ITEMS_NULL);
2264         requireNonNull(mapper, ERROR_MAPPER_NULL);
2265         requireNonNull(filter, ERROR_FILTER_NULL);
2266         return createObjectBinding(() -> {
2267             Function<? super T, R> mapperValue = mapper.getValue();
2268             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2269             Predicate<? super R> filterValue = filter.getValue();
2270             requireNonNull(filterValue, ERROR_FILTER_NULL);
2271             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2272         }, items, mapper, filter);
2273     }
2274 
2275     /**
2276      * Creates an object binding with the first element of an observable set after mapping and filtering.
2277      *
2278      @param items    the observable set of items.
2279      @param supplier a {@code Supplier} whose result is returned if no value is present.
2280      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2281      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2282      *
2283      @return an object binding
2284      */
2285     @Nonnull
2286     public static <T, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<R> supplier, @Nonnull final ObservableValue<Function<? super T, R>> mapper, @Nonnull final ObservableValue<Predicate<? super R>> filter) {
2287         requireNonNull(items, ERROR_ITEMS_NULL);
2288         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2289         requireNonNull(mapper, ERROR_MAPPER_NULL);
2290         requireNonNull(filter, ERROR_FILTER_NULL);
2291         return createObjectBinding(() -> {
2292             Function<? super T, R> mapperValue = mapper.getValue();
2293             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2294             Predicate<? super R> filterValue = filter.getValue();
2295             requireNonNull(filterValue, ERROR_FILTER_NULL);
2296             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2297         }, items, mapper, filter);
2298     }
2299 
2300     /**
2301      * Creates a boolean binding with the first element of an observable set after mapping and filtering.
2302      *
2303      @param items        the observable set of items.
2304      @param defaultValue the value to be returned if there is no value present.
2305      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2306      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2307      *
2308      @return a boolean binding
2309      */
2310     @Nonnull
2311     public static <T> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Boolean defaultValue, @Nonnull final Function<? super T, Boolean> mapper, @Nonnull final Predicate<Boolean> filter) {
2312         requireNonNull(items, ERROR_ITEMS_NULL);
2313         requireNonNull(mapper, ERROR_MAPPER_NULL);
2314         requireNonNull(filter, ERROR_FILTER_NULL);
2315         return createBooleanBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2316     }
2317 
2318     /**
2319      * Creates a boolean binding with the first element of an observable set after mapping and filtering.
2320      *
2321      @param items    the observable set of items.
2322      @param supplier a {@code Supplier} whose result is returned if no value is present.
2323      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2324      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2325      *
2326      @return a boolean binding
2327      */
2328     @Nonnull
2329     public static <T> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Function<? super T, Boolean> mapper, @Nonnull final Predicate<Boolean> filter) {
2330         requireNonNull(items, ERROR_ITEMS_NULL);
2331         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2332         requireNonNull(mapper, ERROR_MAPPER_NULL);
2333         requireNonNull(filter, ERROR_FILTER_NULL);
2334         return createBooleanBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2335     }
2336 
2337     /**
2338      * Creates a boolean binding with the first element of an observable set after mapping and filtering.
2339      *
2340      @param items        the observable set of items.
2341      @param defaultValue the value to be returned if there is no value present.
2342      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2343      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2344      *
2345      @return a boolean binding
2346      */
2347     @Nonnull
2348     public static <T> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Function<? super T, Boolean>> mapper, @Nonnull final ObservableValue<Predicate<Boolean>> filter) {
2349         requireNonNull(items, ERROR_ITEMS_NULL);
2350         requireNonNull(mapper, ERROR_MAPPER_NULL);
2351         requireNonNull(filter, ERROR_FILTER_NULL);
2352         return createBooleanBinding(() -> {
2353             Function<? super T, Boolean> mapperValue = mapper.getValue();
2354             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2355             Predicate<Boolean> filterValue = filter.getValue();
2356             requireNonNull(filterValue, ERROR_FILTER_NULL);
2357             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2358         }, items, mapper, filter);
2359     }
2360 
2361     /**
2362      * Creates a boolean binding with the first element of an observable set after mapping and filtering.
2363      *
2364      @param items    the observable set of items.
2365      @param supplier a {@code Supplier} whose result is returned if no value is present.
2366      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2367      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2368      *
2369      @return a boolean binding
2370      */
2371     @Nonnull
2372     public static <T> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Function<? super T, Boolean>> mapper, @Nonnull final ObservableValue<Predicate<Boolean>> filter) {
2373         requireNonNull(items, ERROR_ITEMS_NULL);
2374         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2375         requireNonNull(mapper, ERROR_MAPPER_NULL);
2376         requireNonNull(filter, ERROR_FILTER_NULL);
2377         return createBooleanBinding(() -> {
2378             Function<? super T, Boolean> mapperValue = mapper.getValue();
2379             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2380             Predicate<Boolean> filterValue = filter.getValue();
2381             requireNonNull(filterValue, ERROR_FILTER_NULL);
2382             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2383         }, items, mapper, filter);
2384     }
2385 
2386     /**
2387      * Creates an integer binding with the first element of an observable set after mapping and filtering.
2388      *
2389      @param items        the observable set of items.
2390      @param defaultValue the value to be returned if there is no value present.
2391      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2392      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2393      *
2394      @return an integer binding
2395      */
2396     @Nonnull
2397     public static <T> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Integer defaultValue, @Nonnull final Function<? super T, Integer> mapper, @Nonnull final Predicate<Integer> filter) {
2398         requireNonNull(items, ERROR_ITEMS_NULL);
2399         requireNonNull(mapper, ERROR_MAPPER_NULL);
2400         requireNonNull(filter, ERROR_FILTER_NULL);
2401         return createIntegerBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2402     }
2403 
2404     /**
2405      * Creates an integer binding with the first element of an observable set after mapping and filtering.
2406      *
2407      @param items    the observable set of items.
2408      @param supplier a {@code Supplier} whose result is returned if no value is present.
2409      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2410      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2411      *
2412      @return an integer binding
2413      */
2414     @Nonnull
2415     public static <T> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Function<? super T, Integer> mapper, @Nonnull final Predicate<Integer> filter) {
2416         requireNonNull(items, ERROR_ITEMS_NULL);
2417         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2418         requireNonNull(mapper, ERROR_MAPPER_NULL);
2419         requireNonNull(filter, ERROR_FILTER_NULL);
2420         return createIntegerBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2421     }
2422 
2423     /**
2424      * Creates an integer binding with the first element of an observable set after mapping and filtering.
2425      *
2426      @param items        the observable set of items.
2427      @param defaultValue the value to be returned if there is no value present.
2428      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2429      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2430      *
2431      @return an integer binding
2432      */
2433     @Nonnull
2434     public static <T> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Function<? super T, Integer>> mapper, @Nonnull final ObservableValue<Predicate<Integer>> filter) {
2435         requireNonNull(items, ERROR_ITEMS_NULL);
2436         requireNonNull(mapper, ERROR_MAPPER_NULL);
2437         requireNonNull(filter, ERROR_FILTER_NULL);
2438         return createIntegerBinding(() -> {
2439             Function<? super T, Integer> mapperValue = mapper.getValue();
2440             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2441             Predicate<Integer> filterValue = filter.getValue();
2442             requireNonNull(filterValue, ERROR_FILTER_NULL);
2443             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2444         }, items, mapper, filter);
2445     }
2446 
2447     /**
2448      * Creates an integer binding with the first element of an observable set after mapping and filtering.
2449      *
2450      @param items    the observable set of items.
2451      @param supplier a {@code Supplier} whose result is returned if no value is present.
2452      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2453      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2454      *
2455      @return an integer binding
2456      */
2457     @Nonnull
2458     public static <T> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Function<? super T, Integer>> mapper, @Nonnull final ObservableValue<Predicate<Integer>> filter) {
2459         requireNonNull(items, ERROR_ITEMS_NULL);
2460         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2461         requireNonNull(mapper, ERROR_MAPPER_NULL);
2462         requireNonNull(filter, ERROR_FILTER_NULL);
2463         return createIntegerBinding(() -> {
2464             Function<? super T, Integer> mapperValue = mapper.getValue();
2465             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2466             Predicate<Integer> filterValue = filter.getValue();
2467             requireNonNull(filterValue, ERROR_FILTER_NULL);
2468             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2469         }, items, mapper, filter);
2470     }
2471 
2472     /**
2473      * Creates a long binding with the first element of an observable set after mapping and filtering.
2474      *
2475      @param items        the observable set of items.
2476      @param defaultValue the value to be returned if there is no value present.
2477      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2478      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2479      *
2480      @return a long binding
2481      */
2482     @Nonnull
2483     public static <T> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Long defaultValue, @Nonnull final Function<? super T, Long> mapper, @Nonnull final Predicate<Long> filter) {
2484         requireNonNull(items, ERROR_ITEMS_NULL);
2485         requireNonNull(mapper, ERROR_MAPPER_NULL);
2486         requireNonNull(filter, ERROR_FILTER_NULL);
2487         return createLongBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2488     }
2489 
2490     /**
2491      * Creates a long binding with the first element of an observable set after mapping and filtering.
2492      *
2493      @param items    the observable set of items.
2494      @param supplier a {@code Supplier} whose result is returned if no value is present.
2495      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2496      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2497      *
2498      @return a long binding
2499      */
2500     @Nonnull
2501     public static <T> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Function<? super T, Long> mapper, @Nonnull final Predicate<Long> filter) {
2502         requireNonNull(items, ERROR_ITEMS_NULL);
2503         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2504         requireNonNull(mapper, ERROR_MAPPER_NULL);
2505         requireNonNull(filter, ERROR_FILTER_NULL);
2506         return createLongBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2507     }
2508 
2509     /**
2510      * Creates a long binding with the first element of an observable set after mapping and filtering.
2511      *
2512      @param items        the observable set of items.
2513      @param defaultValue the value to be returned if there is no value present.
2514      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2515      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2516      *
2517      @return a long binding
2518      */
2519     @Nonnull
2520     public static <T> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Function<? super T, Long>> mapper, @Nonnull final ObservableValue<Predicate<Long>> filter) {
2521         requireNonNull(items, ERROR_ITEMS_NULL);
2522         requireNonNull(mapper, ERROR_MAPPER_NULL);
2523         requireNonNull(filter, ERROR_FILTER_NULL);
2524         return createLongBinding(() -> {
2525             Function<? super T, Long> mapperValue = mapper.getValue();
2526             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2527             Predicate<Long> filterValue = filter.getValue();
2528             requireNonNull(filterValue, ERROR_FILTER_NULL);
2529             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2530         }, items, mapper, filter);
2531     }
2532 
2533     /**
2534      * Creates a long binding with the first element of an observable set after mapping and filtering.
2535      *
2536      @param items    the observable set of items.
2537      @param supplier a {@code Supplier} whose result is returned if no value is present.
2538      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2539      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2540      *
2541      @return a long binding
2542      */
2543     @Nonnull
2544     public static <T> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Function<? super T, Long>> mapper, @Nonnull final ObservableValue<Predicate<Long>> filter) {
2545         requireNonNull(items, ERROR_ITEMS_NULL);
2546         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2547         requireNonNull(mapper, ERROR_MAPPER_NULL);
2548         requireNonNull(filter, ERROR_FILTER_NULL);
2549         return createLongBinding(() -> {
2550             Function<? super T, Long> mapperValue = mapper.getValue();
2551             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2552             Predicate<Long> filterValue = filter.getValue();
2553             requireNonNull(filterValue, ERROR_FILTER_NULL);
2554             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2555         }, items, mapper, filter);
2556     }
2557 
2558     /**
2559      * Creates a float binding with the first element of an observable set after mapping and filtering.
2560      *
2561      @param items        the observable set of items.
2562      @param defaultValue the value to be returned if there is no value present.
2563      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2564      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2565      *
2566      @return a float binding
2567      */
2568     @Nonnull
2569     public static <T> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Float defaultValue, @Nonnull final Function<? super T, Float> mapper, @Nonnull final Predicate<Float> filter) {
2570         requireNonNull(items, ERROR_ITEMS_NULL);
2571         requireNonNull(mapper, ERROR_MAPPER_NULL);
2572         requireNonNull(filter, ERROR_FILTER_NULL);
2573         return createFloatBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2574     }
2575 
2576     /**
2577      * Creates a float binding with the first element of an observable set after mapping and filtering.
2578      *
2579      @param items    the observable set of items.
2580      @param supplier a {@code Supplier} whose result is returned if no value is present.
2581      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2582      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2583      *
2584      @return a float binding
2585      */
2586     @Nonnull
2587     public static <T> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Function<? super T, Float> mapper, @Nonnull final Predicate<Float> filter) {
2588         requireNonNull(items, ERROR_ITEMS_NULL);
2589         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2590         requireNonNull(mapper, ERROR_MAPPER_NULL);
2591         requireNonNull(filter, ERROR_FILTER_NULL);
2592         return createFloatBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2593     }
2594 
2595     /**
2596      * Creates a float binding with the first element of an observable set after mapping and filtering.
2597      *
2598      @param items        the observable set of items.
2599      @param defaultValue the value to be returned if there is no value present.
2600      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2601      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2602      *
2603      @return a float binding
2604      */
2605     @Nonnull
2606     public static <T> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Function<? super T, Float>> mapper, @Nonnull final ObservableValue<Predicate<Float>> filter) {
2607         requireNonNull(items, ERROR_ITEMS_NULL);
2608         requireNonNull(mapper, ERROR_MAPPER_NULL);
2609         requireNonNull(filter, ERROR_FILTER_NULL);
2610         return createFloatBinding(() -> {
2611             Function<? super T, Float> mapperValue = mapper.getValue();
2612             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2613             Predicate<Float> filterValue = filter.getValue();
2614             requireNonNull(filterValue, ERROR_FILTER_NULL);
2615             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2616         }, items, mapper, filter);
2617     }
2618 
2619     /**
2620      * Creates a float binding with the first element of an observable set after mapping and filtering.
2621      *
2622      @param items    the observable set of items.
2623      @param supplier a {@code Supplier} whose result is returned if no value is present.
2624      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2625      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2626      *
2627      @return a float binding
2628      */
2629     @Nonnull
2630     public static <T> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Function<? super T, Float>> mapper, @Nonnull final ObservableValue<Predicate<Float>> filter) {
2631         requireNonNull(items, ERROR_ITEMS_NULL);
2632         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2633         requireNonNull(mapper, ERROR_MAPPER_NULL);
2634         requireNonNull(filter, ERROR_FILTER_NULL);
2635         return createFloatBinding(() -> {
2636             Function<? super T, Float> mapperValue = mapper.getValue();
2637             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2638             Predicate<Float> filterValue = filter.getValue();
2639             requireNonNull(filterValue, ERROR_FILTER_NULL);
2640             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2641         }, items, mapper, filter);
2642     }
2643 
2644     /**
2645      * Creates a double binding with the first element of an observable set after mapping and filtering.
2646      *
2647      @param items        the observable set of items.
2648      @param defaultValue the value to be returned if there is no value present.
2649      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2650      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2651      *
2652      @return a double binding
2653      */
2654     @Nonnull
2655     public static <T> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Double defaultValue, @Nonnull final Function<? super T, Double> mapper, @Nonnull final Predicate<Double> filter) {
2656         requireNonNull(items, ERROR_ITEMS_NULL);
2657         requireNonNull(mapper, ERROR_MAPPER_NULL);
2658         requireNonNull(filter, ERROR_FILTER_NULL);
2659         return createDoubleBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2660     }
2661 
2662     /**
2663      * Creates a double binding with the first element of an observable set after mapping and filtering.
2664      *
2665      @param items    the observable set of items.
2666      @param supplier a {@code Supplier} whose result is returned if no value is present.
2667      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2668      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2669      *
2670      @return a double binding
2671      */
2672     @Nonnull
2673     public static <T> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Function<? super T, Double> mapper, @Nonnull final Predicate<Double> filter) {
2674         requireNonNull(items, ERROR_ITEMS_NULL);
2675         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2676         requireNonNull(mapper, ERROR_MAPPER_NULL);
2677         requireNonNull(filter, ERROR_FILTER_NULL);
2678         return createDoubleBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2679     }
2680 
2681     /**
2682      * Creates a double binding with the first element of an observable set after mapping and filtering.
2683      *
2684      @param items        the observable set of items.
2685      @param defaultValue the value to be returned if there is no value present.
2686      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2687      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2688      *
2689      @return a double binding
2690      */
2691     @Nonnull
2692     public static <T> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Function<? super T, Double>> mapper, @Nonnull final ObservableValue<Predicate<Double>> filter) {
2693         requireNonNull(items, ERROR_ITEMS_NULL);
2694         requireNonNull(mapper, ERROR_MAPPER_NULL);
2695         requireNonNull(filter, ERROR_FILTER_NULL);
2696         return createDoubleBinding(() -> {
2697             Function<? super T, Double> mapperValue = mapper.getValue();
2698             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2699             Predicate<Double> filterValue = filter.getValue();
2700             requireNonNull(filterValue, ERROR_FILTER_NULL);
2701             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2702         }, items, mapper, filter);
2703     }
2704 
2705     /**
2706      * Creates a double binding with the first element of an observable set after mapping and filtering.
2707      *
2708      @param items    the observable set of items.
2709      @param supplier a {@code Supplier} whose result is returned if no value is present.
2710      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2711      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2712      *
2713      @return a double binding
2714      */
2715     @Nonnull
2716     public static <T> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Function<? super T, Double>> mapper, @Nonnull final ObservableValue<Predicate<Double>> filter) {
2717         requireNonNull(items, ERROR_ITEMS_NULL);
2718         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2719         requireNonNull(mapper, ERROR_MAPPER_NULL);
2720         requireNonNull(filter, ERROR_FILTER_NULL);
2721         return createDoubleBinding(() -> {
2722             Function<? super T, Double> mapperValue = mapper.getValue();
2723             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2724             Predicate<Double> filterValue = filter.getValue();
2725             requireNonNull(filterValue, ERROR_FILTER_NULL);
2726             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2727         }, items, mapper, filter);
2728     }
2729 
2730     /**
2731      * Creates a string binding with the first element of an observable set after mapping and filtering.
2732      *
2733      @param items        the observable set of items.
2734      @param defaultValue the value to be returned if there is no value present.
2735      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2736      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2737      *
2738      @return a string binding
2739      */
2740     @Nonnull
2741     public static <T> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final String defaultValue, @Nonnull final Function<? super T, String> mapper, @Nonnull final Predicate<String> filter) {
2742         requireNonNull(items, ERROR_ITEMS_NULL);
2743         requireNonNull(mapper, ERROR_MAPPER_NULL);
2744         requireNonNull(filter, ERROR_FILTER_NULL);
2745         return createStringBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2746     }
2747 
2748     /**
2749      * Creates a string binding with the first element of an observable set after mapping and filtering.
2750      *
2751      @param items    the observable set of items.
2752      @param supplier a {@code Supplier} whose result is returned if no value is present.
2753      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2754      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2755      *
2756      @return a string binding
2757      */
2758     @Nonnull
2759     public static <T> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<String> supplier, @Nonnull final Function<? super T, String> mapper, @Nonnull final Predicate<String> filter) {
2760         requireNonNull(items, ERROR_ITEMS_NULL);
2761         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2762         requireNonNull(mapper, ERROR_MAPPER_NULL);
2763         requireNonNull(filter, ERROR_FILTER_NULL);
2764         return createStringBinding(() -> items.stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2765     }
2766 
2767     /**
2768      * Creates a string binding with the first element of an observable set after mapping and filtering.
2769      *
2770      @param items        the observable set of items.
2771      @param defaultValue the value to be returned if there is no value present.
2772      @param mapper       a non-interfering, stateless function to apply to the each element before filtering.
2773      @param filter       a non-interfering, stateless predicate to apply to the each element. after mapping.
2774      *
2775      @return a string binding
2776      */
2777     @Nonnull
2778     public static <T> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Function<? super T, String>> mapper, @Nonnull final ObservableValue<Predicate<String>> filter) {
2779         requireNonNull(items, ERROR_ITEMS_NULL);
2780         requireNonNull(mapper, ERROR_MAPPER_NULL);
2781         requireNonNull(filter, ERROR_FILTER_NULL);
2782         return createStringBinding(() -> {
2783             Function<? super T, String> mapperValue = mapper.getValue();
2784             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2785             Predicate<String> filterValue = filter.getValue();
2786             requireNonNull(filterValue, ERROR_FILTER_NULL);
2787             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2788         }, items, mapper, filter);
2789     }
2790 
2791     /**
2792      * Creates a string binding with the first element of an observable set after mapping and filtering.
2793      *
2794      @param items    the observable set of items.
2795      @param supplier a {@code Supplier} whose result is returned if no value is present.
2796      @param mapper   a non-interfering, stateless function to apply to the each element before filtering.
2797      @param filter   a non-interfering, stateless predicate to apply to the each element. after mapping.
2798      *
2799      @return a string binding
2800      */
2801     @Nonnull
2802     public static <T> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Function<? super T, String>> mapper, @Nonnull final ObservableValue<Predicate<String>> filter) {
2803         requireNonNull(items, ERROR_ITEMS_NULL);
2804         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2805         requireNonNull(mapper, ERROR_MAPPER_NULL);
2806         requireNonNull(filter, ERROR_FILTER_NULL);
2807         return createStringBinding(() -> {
2808             Function<? super T, String> mapperValue = mapper.getValue();
2809             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2810             Predicate<String> filterValue = filter.getValue();
2811             requireNonNull(filterValue, ERROR_FILTER_NULL);
2812             return items.stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2813         }, items, mapper, filter);
2814     }
2815 
2816     /**
2817      * Creates an object binding with the first value of an observable map after mapping and filtering.
2818      *
2819      @param items        the observable map of items.
2820      @param defaultValue the value to be returned if there is no value present.
2821      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
2822      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
2823      *
2824      @return an object binding
2825      */
2826     @Nonnull
2827     public static <K, V, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final R defaultValue, @Nonnull final Function<? super V, R> mapper, @Nonnull final Predicate<? super R> filter) {
2828         requireNonNull(items, ERROR_ITEMS_NULL);
2829         requireNonNull(mapper, ERROR_MAPPER_NULL);
2830         requireNonNull(filter, ERROR_FILTER_NULL);
2831         return createObjectBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2832     }
2833 
2834     /**
2835      * Creates an object binding with the first value of an observable map after mapping and filtering.
2836      *
2837      @param items    the observable map of items.
2838      @param supplier a {@code Supplier} whose result is returned if no value is present.
2839      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
2840      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
2841      *
2842      @return an object binding
2843      */
2844     @Nonnull
2845     public static <K, V, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<R> supplier, @Nonnull final Function<? super V, R> mapper, @Nonnull final Predicate<? super R> filter) {
2846         requireNonNull(items, ERROR_ITEMS_NULL);
2847         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2848         requireNonNull(mapper, ERROR_MAPPER_NULL);
2849         requireNonNull(filter, ERROR_FILTER_NULL);
2850         return createObjectBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2851     }
2852 
2853     /**
2854      * Creates an object binding with the first value of an observable map after mapping and filtering.
2855      *
2856      @param items        the observable map of items.
2857      @param defaultValue the value to be returned if there is no value present.
2858      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
2859      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
2860      *
2861      @return an object binding
2862      */
2863     @Nonnull
2864     public static <K, V, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final R defaultValue, @Nonnull final ObservableValue<Function<? super V, R>> mapper, @Nonnull final ObservableValue<Predicate<? super R>> filter) {
2865         requireNonNull(items, ERROR_ITEMS_NULL);
2866         requireNonNull(mapper, ERROR_MAPPER_NULL);
2867         requireNonNull(filter, ERROR_FILTER_NULL);
2868         return createObjectBinding(() -> {
2869             Function<? super V, R> mapperValue = mapper.getValue();
2870             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2871             Predicate<? super R> filterValue = filter.getValue();
2872             requireNonNull(filterValue, ERROR_FILTER_NULL);
2873             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2874         }, items, mapper, filter);
2875     }
2876 
2877     /**
2878      * Creates an object binding with the first value of an observable map after mapping and filtering.
2879      *
2880      @param items    the observable map of items.
2881      @param supplier a {@code Supplier} whose result is returned if no value is present.
2882      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
2883      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
2884      *
2885      @return an object binding
2886      */
2887     @Nonnull
2888     public static <K, V, R> ObjectBinding<R> mapThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<R> supplier, @Nonnull final ObservableValue<Function<? super V, R>> mapper, @Nonnull final ObservableValue<Predicate<? super R>> filter) {
2889         requireNonNull(items, ERROR_ITEMS_NULL);
2890         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2891         requireNonNull(mapper, ERROR_MAPPER_NULL);
2892         requireNonNull(filter, ERROR_FILTER_NULL);
2893         return createObjectBinding(() -> {
2894             Function<? super V, R> mapperValue = mapper.getValue();
2895             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2896             Predicate<? super R> filterValue = filter.getValue();
2897             requireNonNull(filterValue, ERROR_FILTER_NULL);
2898             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2899         }, items, mapper, filter);
2900     }
2901 
2902     /**
2903      * Creates a boolean binding with the first value of an observable map after mapping and filtering.
2904      *
2905      @param items        the observable map of items.
2906      @param defaultValue the value to be returned if there is no value present.
2907      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
2908      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
2909      *
2910      @return a boolean binding
2911      */
2912     @Nonnull
2913     public static <K, V> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Boolean defaultValue, @Nonnull final Function<? super V, Boolean> mapper, @Nonnull final Predicate<Boolean> filter) {
2914         requireNonNull(items, ERROR_ITEMS_NULL);
2915         requireNonNull(mapper, ERROR_MAPPER_NULL);
2916         requireNonNull(filter, ERROR_FILTER_NULL);
2917         return createBooleanBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
2918     }
2919 
2920     /**
2921      * Creates a boolean binding with the first value of an observable map after mapping and filtering.
2922      *
2923      @param items    the observable map of items.
2924      @param supplier a {@code Supplier} whose result is returned if no value is present.
2925      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
2926      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
2927      *
2928      @return a boolean binding
2929      */
2930     @Nonnull
2931     public static <K, V> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Function<? super V, Boolean> mapper, @Nonnull final Predicate<Boolean> filter) {
2932         requireNonNull(items, ERROR_ITEMS_NULL);
2933         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2934         requireNonNull(mapper, ERROR_MAPPER_NULL);
2935         requireNonNull(filter, ERROR_FILTER_NULL);
2936         return createBooleanBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
2937     }
2938 
2939     /**
2940      * Creates a boolean binding with the first value of an observable map after mapping and filtering.
2941      *
2942      @param items        the observable map of items.
2943      @param defaultValue the value to be returned if there is no value present.
2944      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
2945      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
2946      *
2947      @return a boolean binding
2948      */
2949     @Nonnull
2950     public static <K, V> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Function<? super V, Boolean>> mapper, @Nonnull final ObservableValue<Predicate<Boolean>> filter) {
2951         requireNonNull(items, ERROR_ITEMS_NULL);
2952         requireNonNull(mapper, ERROR_MAPPER_NULL);
2953         requireNonNull(filter, ERROR_FILTER_NULL);
2954         return createBooleanBinding(() -> {
2955             Function<? super V, Boolean> mapperValue = mapper.getValue();
2956             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2957             Predicate<Boolean> filterValue = filter.getValue();
2958             requireNonNull(filterValue, ERROR_FILTER_NULL);
2959             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
2960         }, items, mapper, filter);
2961     }
2962 
2963     /**
2964      * Creates a boolean binding with the first value of an observable map after mapping and filtering.
2965      *
2966      @param items    the observable map of items.
2967      @param supplier a {@code Supplier} whose result is returned if no value is present.
2968      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
2969      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
2970      *
2971      @return a boolean binding
2972      */
2973     @Nonnull
2974     public static <K, V> BooleanBinding mapToBooleanThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Function<? super V, Boolean>> mapper, @Nonnull final ObservableValue<Predicate<Boolean>> filter) {
2975         requireNonNull(items, ERROR_ITEMS_NULL);
2976         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
2977         requireNonNull(mapper, ERROR_MAPPER_NULL);
2978         requireNonNull(filter, ERROR_FILTER_NULL);
2979         return createBooleanBinding(() -> {
2980             Function<? super V, Boolean> mapperValue = mapper.getValue();
2981             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
2982             Predicate<Boolean> filterValue = filter.getValue();
2983             requireNonNull(filterValue, ERROR_FILTER_NULL);
2984             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
2985         }, items, mapper, filter);
2986     }
2987 
2988     /**
2989      * Creates an integer binding with the first value of an observable map after mapping and filtering.
2990      *
2991      @param items        the observable map of items.
2992      @param defaultValue the value to be returned if there is no value present.
2993      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
2994      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
2995      *
2996      @return an integer binding
2997      */
2998     @Nonnull
2999     public static <K, V> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Integer defaultValue, @Nonnull final Function<? super V, Integer> mapper, @Nonnull final Predicate<Integer> filter) {
3000         requireNonNull(items, ERROR_ITEMS_NULL);
3001         requireNonNull(mapper, ERROR_MAPPER_NULL);
3002         requireNonNull(filter, ERROR_FILTER_NULL);
3003         return createIntegerBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
3004     }
3005 
3006     /**
3007      * Creates an integer binding with the first value of an observable map after mapping and filtering.
3008      *
3009      @param items    the observable map of items.
3010      @param supplier a {@code Supplier} whose result is returned if no value is present.
3011      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3012      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3013      *
3014      @return an integer binding
3015      */
3016     @Nonnull
3017     public static <K, V> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Function<? super V, Integer> mapper, @Nonnull final Predicate<Integer> filter) {
3018         requireNonNull(items, ERROR_ITEMS_NULL);
3019         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3020         requireNonNull(mapper, ERROR_MAPPER_NULL);
3021         requireNonNull(filter, ERROR_FILTER_NULL);
3022         return createIntegerBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
3023     }
3024 
3025     /**
3026      * Creates an integer binding with the first value of an observable map after mapping and filtering.
3027      *
3028      @param items        the observable map of items.
3029      @param defaultValue the value to be returned if there is no value present.
3030      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3031      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3032      *
3033      @return an integer binding
3034      */
3035     @Nonnull
3036     public static <K, V> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Function<? super V, Integer>> mapper, @Nonnull final ObservableValue<Predicate<Integer>> filter) {
3037         requireNonNull(items, ERROR_ITEMS_NULL);
3038         requireNonNull(mapper, ERROR_MAPPER_NULL);
3039         requireNonNull(filter, ERROR_FILTER_NULL);
3040         return createIntegerBinding(() -> {
3041             Function<? super V, Integer> mapperValue = mapper.getValue();
3042             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3043             Predicate<Integer> filterValue = filter.getValue();
3044             requireNonNull(filterValue, ERROR_FILTER_NULL);
3045             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
3046         }, items, mapper, filter);
3047     }
3048 
3049     /**
3050      * Creates an integer binding with the first value of an observable map after mapping and filtering.
3051      *
3052      @param items    the observable map of items.
3053      @param supplier a {@code Supplier} whose result is returned if no value is present.
3054      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3055      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3056      *
3057      @return an integer binding
3058      */
3059     @Nonnull
3060     public static <K, V> IntegerBinding mapToIntegerThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Function<? super V, Integer>> mapper, @Nonnull final ObservableValue<Predicate<Integer>> filter) {
3061         requireNonNull(items, ERROR_ITEMS_NULL);
3062         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3063         requireNonNull(mapper, ERROR_MAPPER_NULL);
3064         requireNonNull(filter, ERROR_FILTER_NULL);
3065         return createIntegerBinding(() -> {
3066             Function<? super V, Integer> mapperValue = mapper.getValue();
3067             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3068             Predicate<Integer> filterValue = filter.getValue();
3069             requireNonNull(filterValue, ERROR_FILTER_NULL);
3070             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
3071         }, items, mapper, filter);
3072     }
3073 
3074     /**
3075      * Creates a long binding with the first value of an observable map after mapping and filtering.
3076      *
3077      @param items        the observable map of items.
3078      @param defaultValue the value to be returned if there is no value present.
3079      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3080      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3081      *
3082      @return a long binding
3083      */
3084     @Nonnull
3085     public static <K, V> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Long defaultValue, @Nonnull final Function<? super V, Long> mapper, @Nonnull final Predicate<Long> filter) {
3086         requireNonNull(items, ERROR_ITEMS_NULL);
3087         requireNonNull(mapper, ERROR_MAPPER_NULL);
3088         requireNonNull(filter, ERROR_FILTER_NULL);
3089         return createLongBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
3090     }
3091 
3092     /**
3093      * Creates a long binding with the first value of an observable map after mapping and filtering.
3094      *
3095      @param items    the observable map of items.
3096      @param supplier a {@code Supplier} whose result is returned if no value is present.
3097      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3098      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3099      *
3100      @return a long binding
3101      */
3102     @Nonnull
3103     public static <K, V> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Function<? super V, Long> mapper, @Nonnull final Predicate<Long> filter) {
3104         requireNonNull(items, ERROR_ITEMS_NULL);
3105         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3106         requireNonNull(mapper, ERROR_MAPPER_NULL);
3107         requireNonNull(filter, ERROR_FILTER_NULL);
3108         return createLongBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
3109     }
3110 
3111     /**
3112      * Creates a long binding with the first value of an observable map after mapping and filtering.
3113      *
3114      @param items        the observable map of items.
3115      @param defaultValue the value to be returned if there is no value present.
3116      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3117      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3118      *
3119      @return a long binding
3120      */
3121     @Nonnull
3122     public static <K, V> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Function<? super V, Long>> mapper, @Nonnull final ObservableValue<Predicate<Long>> filter) {
3123         requireNonNull(items, ERROR_ITEMS_NULL);
3124         requireNonNull(mapper, ERROR_MAPPER_NULL);
3125         requireNonNull(filter, ERROR_FILTER_NULL);
3126         return createLongBinding(() -> {
3127             Function<? super V, Long> mapperValue = mapper.getValue();
3128             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3129             Predicate<Long> filterValue = filter.getValue();
3130             requireNonNull(filterValue, ERROR_FILTER_NULL);
3131             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
3132         }, items, mapper, filter);
3133     }
3134 
3135     /**
3136      * Creates a long binding with the first value of an observable map after mapping and filtering.
3137      *
3138      @param items    the observable map of items.
3139      @param supplier a {@code Supplier} whose result is returned if no value is present.
3140      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3141      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3142      *
3143      @return a long binding
3144      */
3145     @Nonnull
3146     public static <K, V> LongBinding mapToLongThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Function<? super V, Long>> mapper, @Nonnull final ObservableValue<Predicate<Long>> filter) {
3147         requireNonNull(items, ERROR_ITEMS_NULL);
3148         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3149         requireNonNull(mapper, ERROR_MAPPER_NULL);
3150         requireNonNull(filter, ERROR_FILTER_NULL);
3151         return createLongBinding(() -> {
3152             Function<? super V, Long> mapperValue = mapper.getValue();
3153             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3154             Predicate<Long> filterValue = filter.getValue();
3155             requireNonNull(filterValue, ERROR_FILTER_NULL);
3156             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
3157         }, items, mapper, filter);
3158     }
3159 
3160     /**
3161      * Creates a float binding with the first value of an observable map after mapping and filtering.
3162      *
3163      @param items        the observable map of items.
3164      @param defaultValue the value to be returned if there is no value present.
3165      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3166      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3167      *
3168      @return a float binding
3169      */
3170     @Nonnull
3171     public static <K, V> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Float defaultValue, @Nonnull final Function<? super V, Float> mapper, @Nonnull final Predicate<Float> filter) {
3172         requireNonNull(items, ERROR_ITEMS_NULL);
3173         requireNonNull(mapper, ERROR_MAPPER_NULL);
3174         requireNonNull(filter, ERROR_FILTER_NULL);
3175         return createFloatBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
3176     }
3177 
3178     /**
3179      * Creates a float binding with the first value of an observable map after mapping and filtering.
3180      *
3181      @param items    the observable map of items.
3182      @param supplier a {@code Supplier} whose result is returned if no value is present.
3183      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3184      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3185      *
3186      @return a float binding
3187      */
3188     @Nonnull
3189     public static <K, V> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Function<? super V, Float> mapper, @Nonnull final Predicate<Float> filter) {
3190         requireNonNull(items, ERROR_ITEMS_NULL);
3191         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3192         requireNonNull(mapper, ERROR_MAPPER_NULL);
3193         requireNonNull(filter, ERROR_FILTER_NULL);
3194         return createFloatBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
3195     }
3196 
3197     /**
3198      * Creates a float binding with the first value of an observable map after mapping and filtering.
3199      *
3200      @param items        the observable map of items.
3201      @param defaultValue the value to be returned if there is no value present.
3202      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3203      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3204      *
3205      @return a float binding
3206      */
3207     @Nonnull
3208     public static <K, V> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Function<? super V, Float>> mapper, @Nonnull final ObservableValue<Predicate<Float>> filter) {
3209         requireNonNull(items, ERROR_ITEMS_NULL);
3210         requireNonNull(mapper, ERROR_MAPPER_NULL);
3211         requireNonNull(filter, ERROR_FILTER_NULL);
3212         return createFloatBinding(() -> {
3213             Function<? super V, Float> mapperValue = mapper.getValue();
3214             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3215             Predicate<Float> filterValue = filter.getValue();
3216             requireNonNull(filterValue, ERROR_FILTER_NULL);
3217             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
3218         }, items, mapper, filter);
3219     }
3220 
3221     /**
3222      * Creates a float binding with the first value of an observable map after mapping and filtering.
3223      *
3224      @param items    the observable map of items.
3225      @param supplier a {@code Supplier} whose result is returned if no value is present.
3226      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3227      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3228      *
3229      @return a float binding
3230      */
3231     @Nonnull
3232     public static <K, V> FloatBinding mapToFloatThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Function<? super V, Float>> mapper, @Nonnull final ObservableValue<Predicate<Float>> filter) {
3233         requireNonNull(items, ERROR_ITEMS_NULL);
3234         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3235         requireNonNull(mapper, ERROR_MAPPER_NULL);
3236         requireNonNull(filter, ERROR_FILTER_NULL);
3237         return createFloatBinding(() -> {
3238             Function<? super V, Float> mapperValue = mapper.getValue();
3239             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3240             Predicate<Float> filterValue = filter.getValue();
3241             requireNonNull(filterValue, ERROR_FILTER_NULL);
3242             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
3243         }, items, mapper, filter);
3244     }
3245 
3246     /**
3247      * Creates a double binding with the first value of an observable map after mapping and filtering.
3248      *
3249      @param items        the observable map of items.
3250      @param defaultValue the value to be returned if there is no value present.
3251      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3252      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3253      *
3254      @return a double binding
3255      */
3256     @Nonnull
3257     public static <K, V> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Double defaultValue, @Nonnull final Function<? super V, Double> mapper, @Nonnull final Predicate<Double> filter) {
3258         requireNonNull(items, ERROR_ITEMS_NULL);
3259         requireNonNull(mapper, ERROR_MAPPER_NULL);
3260         requireNonNull(filter, ERROR_FILTER_NULL);
3261         return createDoubleBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
3262     }
3263 
3264     /**
3265      * Creates a double binding with the first value of an observable map after mapping and filtering.
3266      *
3267      @param items    the observable map of items.
3268      @param supplier a {@code Supplier} whose result is returned if no value is present.
3269      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3270      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3271      *
3272      @return a double binding
3273      */
3274     @Nonnull
3275     public static <K, V> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Function<? super V, Double> mapper, @Nonnull final Predicate<Double> filter) {
3276         requireNonNull(items, ERROR_ITEMS_NULL);
3277         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3278         requireNonNull(mapper, ERROR_MAPPER_NULL);
3279         requireNonNull(filter, ERROR_FILTER_NULL);
3280         return createDoubleBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
3281     }
3282 
3283     /**
3284      * Creates a double binding with the first value of an observable map after mapping and filtering.
3285      *
3286      @param items        the observable map of items.
3287      @param defaultValue the value to be returned if there is no value present.
3288      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3289      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3290      *
3291      @return a double binding
3292      */
3293     @Nonnull
3294     public static <K, V> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Function<? super V, Double>> mapper, @Nonnull final ObservableValue<Predicate<Double>> filter) {
3295         requireNonNull(items, ERROR_ITEMS_NULL);
3296         requireNonNull(mapper, ERROR_MAPPER_NULL);
3297         requireNonNull(filter, ERROR_FILTER_NULL);
3298         return createDoubleBinding(() -> {
3299             Function<? super V, Double> mapperValue = mapper.getValue();
3300             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3301             Predicate<Double> filterValue = filter.getValue();
3302             requireNonNull(filterValue, ERROR_FILTER_NULL);
3303             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
3304         }, items, mapper, filter);
3305     }
3306 
3307     /**
3308      * Creates a double binding with the first value of an observable map after mapping and filtering.
3309      *
3310      @param items    the observable map of items.
3311      @param supplier a {@code Supplier} whose result is returned if no value is present.
3312      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3313      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3314      *
3315      @return a double binding
3316      */
3317     @Nonnull
3318     public static <K, V> DoubleBinding mapToDoubleThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Function<? super V, Double>> mapper, @Nonnull final ObservableValue<Predicate<Double>> filter) {
3319         requireNonNull(items, ERROR_ITEMS_NULL);
3320         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3321         requireNonNull(mapper, ERROR_MAPPER_NULL);
3322         requireNonNull(filter, ERROR_FILTER_NULL);
3323         return createDoubleBinding(() -> {
3324             Function<? super V, Double> mapperValue = mapper.getValue();
3325             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3326             Predicate<Double> filterValue = filter.getValue();
3327             requireNonNull(filterValue, ERROR_FILTER_NULL);
3328             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
3329         }, items, mapper, filter);
3330     }
3331 
3332     /**
3333      * Creates a string binding with the first value of an observable map after mapping and filtering.
3334      *
3335      @param items        the observable map of items.
3336      @param defaultValue the value to be returned if there is no value present.
3337      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3338      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3339      *
3340      @return a string binding
3341      */
3342     @Nonnull
3343     public static <K, V> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final String defaultValue, @Nonnull final Function<? super V, String> mapper, @Nonnull final Predicate<String> filter) {
3344         requireNonNull(items, ERROR_ITEMS_NULL);
3345         requireNonNull(mapper, ERROR_MAPPER_NULL);
3346         requireNonNull(filter, ERROR_FILTER_NULL);
3347         return createStringBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElse(defaultValue), items);
3348     }
3349 
3350     /**
3351      * Creates a string binding with the first value of an observable map after mapping and filtering.
3352      *
3353      @param items    the observable map of items.
3354      @param supplier a {@code Supplier} whose result is returned if no value is present.
3355      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3356      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3357      *
3358      @return a string binding
3359      */
3360     @Nonnull
3361     public static <K, V> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<String> supplier, @Nonnull final Function<? super V, String> mapper, @Nonnull final Predicate<String> filter) {
3362         requireNonNull(items, ERROR_ITEMS_NULL);
3363         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3364         requireNonNull(mapper, ERROR_MAPPER_NULL);
3365         requireNonNull(filter, ERROR_FILTER_NULL);
3366         return createStringBinding(() -> items.values().stream().map(mapper).filter(filter).findFirst().orElseGet(supplier), items);
3367     }
3368 
3369     /**
3370      * Creates a string binding with the first value of an observable map after mapping and filtering.
3371      *
3372      @param items        the observable map of items.
3373      @param defaultValue the value to be returned if there is no value present.
3374      @param mapper       a non-interfering, stateless function to apply to the each value before filtering.
3375      @param filter       a non-interfering, stateless predicate to apply to the each value after mapping.
3376      *
3377      @return a string binding
3378      */
3379     @Nonnull
3380     public static <K, V> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Function<? super V, String>> mapper, @Nonnull final ObservableValue<Predicate<String>> filter) {
3381         requireNonNull(items, ERROR_ITEMS_NULL);
3382         requireNonNull(mapper, ERROR_MAPPER_NULL);
3383         requireNonNull(filter, ERROR_FILTER_NULL);
3384         return createStringBinding(() -> {
3385             Function<? super V, String> mapperValue = mapper.getValue();
3386             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3387             Predicate<String> filterValue = filter.getValue();
3388             requireNonNull(filterValue, ERROR_FILTER_NULL);
3389             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElse(defaultValue);
3390         }, items, mapper, filter);
3391     }
3392 
3393     /**
3394      * Creates a string binding with the first value of an observable map after mapping and filtering.
3395      *
3396      @param items    the observable map of items.
3397      @param supplier a {@code Supplier} whose result is returned if no value is present.
3398      @param mapper   a non-interfering, stateless function to apply to the each value before filtering.
3399      @param filter   a non-interfering, stateless predicate to apply to the each value after mapping.
3400      *
3401      @return a string binding
3402      */
3403     @Nonnull
3404     public static <K, V> StringBinding mapToStringThenFilterThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Function<? super V, String>> mapper, @Nonnull final ObservableValue<Predicate<String>> filter) {
3405         requireNonNull(items, ERROR_ITEMS_NULL);
3406         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3407         requireNonNull(mapper, ERROR_MAPPER_NULL);
3408         requireNonNull(filter, ERROR_FILTER_NULL);
3409         return createStringBinding(() -> {
3410             Function<? super V, String> mapperValue = mapper.getValue();
3411             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3412             Predicate<String> filterValue = filter.getValue();
3413             requireNonNull(filterValue, ERROR_FILTER_NULL);
3414             return items.values().stream().map(mapperValue).filter(filterValue).findFirst().orElseGet(supplier);
3415         }, items, mapper, filter);
3416     }
3417 
3418     /**
3419      * Creates an object binding with the first element of an observable list after filtering and mapping.
3420      *
3421      @param items        the observable list of items.
3422      @param defaultValue the value to be returned if there is no value present.
3423      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3424      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3425      *
3426      @return an object binding
3427      */
3428     @Nonnull
3429     public static <T, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final R defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, R> mapper) {
3430         requireNonNull(items, ERROR_ITEMS_NULL);
3431         requireNonNull(filter, ERROR_FILTER_NULL);
3432         requireNonNull(mapper, ERROR_MAPPER_NULL);
3433         return createObjectBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
3434     }
3435 
3436     /**
3437      * Creates an object binding with the first element of an observable list after filtering and mapping.
3438      *
3439      @param items    the observable list of items.
3440      @param supplier a {@code Supplier} whose result is returned if no value is present.
3441      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3442      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3443      *
3444      @return an object binding
3445      */
3446     @Nonnull
3447     public static <T, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<R> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, R> mapper) {
3448         requireNonNull(items, ERROR_ITEMS_NULL);
3449         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3450         requireNonNull(filter, ERROR_FILTER_NULL);
3451         requireNonNull(mapper, ERROR_MAPPER_NULL);
3452         return createObjectBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
3453     }
3454 
3455     /**
3456      * Creates an object binding with the first element of an observable list after filtering and mapping.
3457      *
3458      @param items        the observable list of items.
3459      @param defaultValue the value to be returned if there is no value present.
3460      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3461      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3462      *
3463      @return an object binding
3464      */
3465     @Nonnull
3466     public static <T, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final R defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, R>> mapper) {
3467         requireNonNull(items, ERROR_ITEMS_NULL);
3468         requireNonNull(filter, ERROR_FILTER_NULL);
3469         requireNonNull(mapper, ERROR_MAPPER_NULL);
3470         return createObjectBinding(() -> {
3471             Function<? super T, R> mapperValue = mapper.getValue();
3472             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3473             Predicate<? super T> filterValue = filter.getValue();
3474             requireNonNull(filterValue, ERROR_FILTER_NULL);
3475             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
3476         }, items, mapper, filter);
3477     }
3478 
3479     /**
3480      * Creates an object binding with the first element of an observable list after filtering and mapping.
3481      *
3482      @param items    the observable list of items.
3483      @param supplier a {@code Supplier} whose result is returned if no value is present.
3484      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3485      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3486      *
3487      @return an object binding
3488      */
3489     @Nonnull
3490     public static <T, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<R> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, R>> mapper) {
3491         requireNonNull(items, ERROR_ITEMS_NULL);
3492         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3493         requireNonNull(filter, ERROR_FILTER_NULL);
3494         requireNonNull(mapper, ERROR_MAPPER_NULL);
3495         return createObjectBinding(() -> {
3496             Function<? super T, R> mapperValue = mapper.getValue();
3497             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3498             Predicate<? super T> filterValue = filter.getValue();
3499             requireNonNull(filterValue, ERROR_FILTER_NULL);
3500             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
3501         }, items, mapper, filter);
3502     }
3503 
3504     /**
3505      * Creates a boolean binding with the first element of an observable list after filtering and mapping.
3506      *
3507      @param items        the observable list of items.
3508      @param defaultValue the value to be returned if there is no value present.
3509      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3510      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3511      *
3512      @return a boolean binding
3513      */
3514     @Nonnull
3515     public static <T> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Boolean defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Boolean> mapper) {
3516         requireNonNull(items, ERROR_ITEMS_NULL);
3517         requireNonNull(filter, ERROR_FILTER_NULL);
3518         requireNonNull(mapper, ERROR_MAPPER_NULL);
3519         return createBooleanBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
3520     }
3521 
3522     /**
3523      * Creates a boolean binding with the first element of an observable list after filtering and mapping.
3524      *
3525      @param items    the observable list of items.
3526      @param supplier a {@code Supplier} whose result is returned if no value is present.
3527      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3528      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3529      *
3530      @return a boolean binding
3531      */
3532     @Nonnull
3533     public static <T> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Boolean> mapper) {
3534         requireNonNull(items, ERROR_ITEMS_NULL);
3535         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3536         requireNonNull(filter, ERROR_FILTER_NULL);
3537         requireNonNull(mapper, ERROR_MAPPER_NULL);
3538         return createBooleanBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
3539     }
3540 
3541     /**
3542      * Creates a boolean binding with the first element of an observable list after filtering and mapping.
3543      *
3544      @param items        the observable list of items.
3545      @param defaultValue the value to be returned if there is no value present.
3546      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3547      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3548      *
3549      @return a boolean binding
3550      */
3551     @Nonnull
3552     public static <T> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Boolean>> mapper) {
3553         requireNonNull(items, ERROR_ITEMS_NULL);
3554         requireNonNull(filter, ERROR_FILTER_NULL);
3555         requireNonNull(mapper, ERROR_MAPPER_NULL);
3556         return createBooleanBinding(() -> {
3557             Function<? super T, Boolean> mapperValue = mapper.getValue();
3558             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3559             Predicate<? super T> filterValue = filter.getValue();
3560             requireNonNull(filterValue, ERROR_FILTER_NULL);
3561             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
3562         }, items, mapper, filter);
3563     }
3564 
3565     /**
3566      * Creates a boolean binding with the first element of an observable list after filtering and mapping.
3567      *
3568      @param items    the observable list of items.
3569      @param supplier a {@code Supplier} whose result is returned if no value is present.
3570      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3571      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3572      *
3573      @return a boolean binding
3574      */
3575     @Nonnull
3576     public static <T> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Boolean>> mapper) {
3577         requireNonNull(items, ERROR_ITEMS_NULL);
3578         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3579         requireNonNull(filter, ERROR_FILTER_NULL);
3580         requireNonNull(mapper, ERROR_MAPPER_NULL);
3581         return createBooleanBinding(() -> {
3582             Function<? super T, Boolean> mapperValue = mapper.getValue();
3583             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3584             Predicate<? super T> filterValue = filter.getValue();
3585             requireNonNull(filterValue, ERROR_FILTER_NULL);
3586             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
3587         }, items, mapper, filter);
3588     }
3589 
3590     /**
3591      * Creates an integer binding with the first element of an observable list after filtering and mapping.
3592      *
3593      @param items        the observable list of items.
3594      @param defaultValue the value to be returned if there is no value present.
3595      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3596      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3597      *
3598      @return an integer binding
3599      */
3600     @Nonnull
3601     public static <T> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Integer defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Integer> mapper) {
3602         requireNonNull(items, ERROR_ITEMS_NULL);
3603         requireNonNull(filter, ERROR_FILTER_NULL);
3604         requireNonNull(mapper, ERROR_MAPPER_NULL);
3605         return createIntegerBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
3606     }
3607 
3608     /**
3609      * Creates an integer binding with the first element of an observable list after filtering and mapping.
3610      *
3611      @param items    the observable list of items.
3612      @param supplier a {@code Supplier} whose result is returned if no value is present.
3613      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3614      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3615      *
3616      @return an integer binding
3617      */
3618     @Nonnull
3619     public static <T> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Integer> mapper) {
3620         requireNonNull(items, ERROR_ITEMS_NULL);
3621         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3622         requireNonNull(filter, ERROR_FILTER_NULL);
3623         requireNonNull(mapper, ERROR_MAPPER_NULL);
3624         return createIntegerBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
3625     }
3626 
3627     /**
3628      * Creates an integer binding with the first element of an observable list after filtering and mapping.
3629      *
3630      @param items        the observable list of items.
3631      @param defaultValue the value to be returned if there is no value present.
3632      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3633      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3634      *
3635      @return an integer binding
3636      */
3637     @Nonnull
3638     public static <T> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Integer>> mapper) {
3639         requireNonNull(items, ERROR_ITEMS_NULL);
3640         requireNonNull(filter, ERROR_FILTER_NULL);
3641         requireNonNull(mapper, ERROR_MAPPER_NULL);
3642         return createIntegerBinding(() -> {
3643             Function<? super T, Integer> mapperValue = mapper.getValue();
3644             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3645             Predicate<? super T> filterValue = filter.getValue();
3646             requireNonNull(filterValue, ERROR_FILTER_NULL);
3647             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
3648         }, items, mapper, filter);
3649     }
3650 
3651     /**
3652      * Creates an integer binding with the first element of an observable list after filtering and mapping.
3653      *
3654      @param items    the observable list of items.
3655      @param supplier a {@code Supplier} whose result is returned if no value is present.
3656      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3657      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3658      *
3659      @return an integer binding
3660      */
3661     @Nonnull
3662     public static <T> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Integer>> mapper) {
3663         requireNonNull(items, ERROR_ITEMS_NULL);
3664         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3665         requireNonNull(filter, ERROR_FILTER_NULL);
3666         requireNonNull(mapper, ERROR_MAPPER_NULL);
3667         return createIntegerBinding(() -> {
3668             Function<? super T, Integer> mapperValue = mapper.getValue();
3669             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3670             Predicate<? super T> filterValue = filter.getValue();
3671             requireNonNull(filterValue, ERROR_FILTER_NULL);
3672             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
3673         }, items, mapper, filter);
3674     }
3675 
3676     /**
3677      * Creates a long binding with the first element of an observable list after filtering and mapping.
3678      *
3679      @param items        the observable list of items.
3680      @param defaultValue the value to be returned if there is no value present.
3681      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3682      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3683      *
3684      @return a long binding
3685      */
3686     @Nonnull
3687     public static <T> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Long defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Long> mapper) {
3688         requireNonNull(items, ERROR_ITEMS_NULL);
3689         requireNonNull(filter, ERROR_FILTER_NULL);
3690         requireNonNull(mapper, ERROR_MAPPER_NULL);
3691         return createLongBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
3692     }
3693 
3694     /**
3695      * Creates a long binding with the first element of an observable list after filtering and mapping.
3696      *
3697      @param items    the observable list of items.
3698      @param supplier a {@code Supplier} whose result is returned if no value is present.
3699      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3700      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3701      *
3702      @return a long binding
3703      */
3704     @Nonnull
3705     public static <T> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Long> mapper) {
3706         requireNonNull(items, ERROR_ITEMS_NULL);
3707         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3708         requireNonNull(filter, ERROR_FILTER_NULL);
3709         requireNonNull(mapper, ERROR_MAPPER_NULL);
3710         return createLongBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
3711     }
3712 
3713     /**
3714      * Creates a long binding with the first element of an observable list after filtering and mapping.
3715      *
3716      @param items        the observable list of items.
3717      @param defaultValue the value to be returned if there is no value present.
3718      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3719      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3720      *
3721      @return a long binding
3722      */
3723     @Nonnull
3724     public static <T> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Long>> mapper) {
3725         requireNonNull(items, ERROR_ITEMS_NULL);
3726         requireNonNull(filter, ERROR_FILTER_NULL);
3727         requireNonNull(mapper, ERROR_MAPPER_NULL);
3728         return createLongBinding(() -> {
3729             Function<? super T, Long> mapperValue = mapper.getValue();
3730             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3731             Predicate<? super T> filterValue = filter.getValue();
3732             requireNonNull(filterValue, ERROR_FILTER_NULL);
3733             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
3734         }, items, mapper, filter);
3735     }
3736 
3737     /**
3738      * Creates a long binding with the first element of an observable list after filtering and mapping.
3739      *
3740      @param items    the observable list of items.
3741      @param supplier a {@code Supplier} whose result is returned if no value is present.
3742      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3743      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3744      *
3745      @return a long binding
3746      */
3747     @Nonnull
3748     public static <T> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Long>> mapper) {
3749         requireNonNull(items, ERROR_ITEMS_NULL);
3750         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3751         requireNonNull(filter, ERROR_FILTER_NULL);
3752         requireNonNull(mapper, ERROR_MAPPER_NULL);
3753         return createLongBinding(() -> {
3754             Function<? super T, Long> mapperValue = mapper.getValue();
3755             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3756             Predicate<? super T> filterValue = filter.getValue();
3757             requireNonNull(filterValue, ERROR_FILTER_NULL);
3758             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
3759         }, items, mapper, filter);
3760     }
3761 
3762     /**
3763      * Creates a float binding with the first element of an observable list after filtering and mapping.
3764      *
3765      @param items        the observable list of items.
3766      @param defaultValue the value to be returned if there is no value present.
3767      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3768      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3769      *
3770      @return a float binding
3771      */
3772     @Nonnull
3773     public static <T> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Float defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Float> mapper) {
3774         requireNonNull(items, ERROR_ITEMS_NULL);
3775         requireNonNull(filter, ERROR_FILTER_NULL);
3776         requireNonNull(mapper, ERROR_MAPPER_NULL);
3777         return createFloatBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
3778     }
3779 
3780     /**
3781      * Creates a float binding with the first element of an observable list after filtering and mapping.
3782      *
3783      @param items    the observable list of items.
3784      @param supplier a {@code Supplier} whose result is returned if no value is present.
3785      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3786      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3787      *
3788      @return a float binding
3789      */
3790     @Nonnull
3791     public static <T> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Float> mapper) {
3792         requireNonNull(items, ERROR_ITEMS_NULL);
3793         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3794         requireNonNull(filter, ERROR_FILTER_NULL);
3795         requireNonNull(mapper, ERROR_MAPPER_NULL);
3796         return createFloatBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
3797     }
3798 
3799     /**
3800      * Creates a float binding with the first element of an observable list after filtering and mapping.
3801      *
3802      @param items        the observable list of items.
3803      @param defaultValue the value to be returned if there is no value present.
3804      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3805      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3806      *
3807      @return a float binding
3808      */
3809     @Nonnull
3810     public static <T> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Float>> mapper) {
3811         requireNonNull(items, ERROR_ITEMS_NULL);
3812         requireNonNull(filter, ERROR_FILTER_NULL);
3813         requireNonNull(mapper, ERROR_MAPPER_NULL);
3814         return createFloatBinding(() -> {
3815             Function<? super T, Float> mapperValue = mapper.getValue();
3816             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3817             Predicate<? super T> filterValue = filter.getValue();
3818             requireNonNull(filterValue, ERROR_FILTER_NULL);
3819             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
3820         }, items, mapper, filter);
3821     }
3822 
3823     /**
3824      * Creates a float binding with the first element of an observable list after filtering and mapping.
3825      *
3826      @param items    the observable list of items.
3827      @param supplier a {@code Supplier} whose result is returned if no value is present.
3828      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3829      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3830      *
3831      @return a float binding
3832      */
3833     @Nonnull
3834     public static <T> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Float>> mapper) {
3835         requireNonNull(items, ERROR_ITEMS_NULL);
3836         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3837         requireNonNull(filter, ERROR_FILTER_NULL);
3838         requireNonNull(mapper, ERROR_MAPPER_NULL);
3839         return createFloatBinding(() -> {
3840             Function<? super T, Float> mapperValue = mapper.getValue();
3841             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3842             Predicate<? super T> filterValue = filter.getValue();
3843             requireNonNull(filterValue, ERROR_FILTER_NULL);
3844             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
3845         }, items, mapper, filter);
3846     }
3847 
3848     /**
3849      * Creates a double binding with the first element of an observable list after filtering and mapping.
3850      *
3851      @param items        the observable list of items.
3852      @param defaultValue the value to be returned if there is no value present.
3853      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3854      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3855      *
3856      @return a double binding
3857      */
3858     @Nonnull
3859     public static <T> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Double defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Double> mapper) {
3860         requireNonNull(items, ERROR_ITEMS_NULL);
3861         requireNonNull(filter, ERROR_FILTER_NULL);
3862         requireNonNull(mapper, ERROR_MAPPER_NULL);
3863         return createDoubleBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
3864     }
3865 
3866     /**
3867      * Creates a double binding with the first element of an observable list after filtering and mapping.
3868      *
3869      @param items    the observable list of items.
3870      @param supplier a {@code Supplier} whose result is returned if no value is present.
3871      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3872      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3873      *
3874      @return a double binding
3875      */
3876     @Nonnull
3877     public static <T> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Double> mapper) {
3878         requireNonNull(items, ERROR_ITEMS_NULL);
3879         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3880         requireNonNull(filter, ERROR_FILTER_NULL);
3881         requireNonNull(mapper, ERROR_MAPPER_NULL);
3882         return createDoubleBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
3883     }
3884 
3885     /**
3886      * Creates a double binding with the first element of an observable list after filtering and mapping.
3887      *
3888      @param items        the observable list of items.
3889      @param defaultValue the value to be returned if there is no value present.
3890      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3891      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3892      *
3893      @return a double binding
3894      */
3895     @Nonnull
3896     public static <T> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Double>> mapper) {
3897         requireNonNull(items, ERROR_ITEMS_NULL);
3898         requireNonNull(filter, ERROR_FILTER_NULL);
3899         requireNonNull(mapper, ERROR_MAPPER_NULL);
3900         return createDoubleBinding(() -> {
3901             Function<? super T, Double> mapperValue = mapper.getValue();
3902             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3903             Predicate<? super T> filterValue = filter.getValue();
3904             requireNonNull(filterValue, ERROR_FILTER_NULL);
3905             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
3906         }, items, mapper, filter);
3907     }
3908 
3909     /**
3910      * Creates a double binding with the first element of an observable list after filtering and mapping.
3911      *
3912      @param items    the observable list of items.
3913      @param supplier a {@code Supplier} whose result is returned if no value is present.
3914      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3915      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3916      *
3917      @return a double binding
3918      */
3919     @Nonnull
3920     public static <T> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Double>> mapper) {
3921         requireNonNull(items, ERROR_ITEMS_NULL);
3922         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3923         requireNonNull(filter, ERROR_FILTER_NULL);
3924         requireNonNull(mapper, ERROR_MAPPER_NULL);
3925         return createDoubleBinding(() -> {
3926             Function<? super T, Double> mapperValue = mapper.getValue();
3927             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3928             Predicate<? super T> filterValue = filter.getValue();
3929             requireNonNull(filterValue, ERROR_FILTER_NULL);
3930             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
3931         }, items, mapper, filter);
3932     }
3933 
3934     /**
3935      * Creates a string binding with the first element of an observable list after filtering and mapping.
3936      *
3937      @param items        the observable list of items.
3938      @param defaultValue the value to be returned if there is no value present.
3939      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3940      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3941      *
3942      @return a string binding
3943      */
3944     @Nonnull
3945     public static <T> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final String defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, String> mapper) {
3946         requireNonNull(items, ERROR_ITEMS_NULL);
3947         requireNonNull(filter, ERROR_FILTER_NULL);
3948         requireNonNull(mapper, ERROR_MAPPER_NULL);
3949         return createStringBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
3950     }
3951 
3952     /**
3953      * Creates a string binding with the first element of an observable list after filtering and mapping.
3954      *
3955      @param items    the observable list of items.
3956      @param supplier a {@code Supplier} whose result is returned if no value is present.
3957      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
3958      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
3959      *
3960      @return a string binding
3961      */
3962     @Nonnull
3963     public static <T> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<String> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, String> mapper) {
3964         requireNonNull(items, ERROR_ITEMS_NULL);
3965         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
3966         requireNonNull(filter, ERROR_FILTER_NULL);
3967         requireNonNull(mapper, ERROR_MAPPER_NULL);
3968         return createStringBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
3969     }
3970 
3971     /**
3972      * Creates a string binding with the first element of an observable list after filtering and mapping.
3973      *
3974      @param items        the observable list of items.
3975      @param defaultValue the value to be returned if there is no value present.
3976      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
3977      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
3978      *
3979      @return a string binding
3980      */
3981     @Nonnull
3982     public static <T> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, String>> mapper) {
3983         requireNonNull(items, ERROR_ITEMS_NULL);
3984         requireNonNull(filter, ERROR_FILTER_NULL);
3985         requireNonNull(mapper, ERROR_MAPPER_NULL);
3986         return createStringBinding(() -> {
3987             Function<? super T, String> mapperValue = mapper.getValue();
3988             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
3989             Predicate<? super T> filterValue = filter.getValue();
3990             requireNonNull(filterValue, ERROR_FILTER_NULL);
3991             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
3992         }, items, mapper, filter);
3993     }
3994 
3995     /**
3996      * Creates a string binding with the first element of an observable list after filtering and mapping.
3997      *
3998      @param items    the observable list of items.
3999      @param supplier a {@code Supplier} whose result is returned if no value is present.
4000      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4001      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4002      *
4003      @return a string binding
4004      */
4005     @Nonnull
4006     public static <T> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableList<T> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, String>> mapper) {
4007         requireNonNull(items, ERROR_ITEMS_NULL);
4008         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4009         requireNonNull(filter, ERROR_FILTER_NULL);
4010         requireNonNull(mapper, ERROR_MAPPER_NULL);
4011         return createStringBinding(() -> {
4012             Function<? super T, String> mapperValue = mapper.getValue();
4013             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4014             Predicate<? super T> filterValue = filter.getValue();
4015             requireNonNull(filterValue, ERROR_FILTER_NULL);
4016             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4017         }, items, mapper, filter);
4018     }
4019 
4020     /**
4021      * Creates an object binding with the first element of an observable set after filtering and mapping.
4022      *
4023      @param items        the observable set of items.
4024      @param defaultValue the value to be returned if there is no value present.
4025      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4026      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4027      *
4028      @return an object binding
4029      */
4030     @Nonnull
4031     public static <T, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final R defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, R> mapper) {
4032         requireNonNull(items, ERROR_ITEMS_NULL);
4033         requireNonNull(filter, ERROR_FILTER_NULL);
4034         requireNonNull(mapper, ERROR_MAPPER_NULL);
4035         return createObjectBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4036     }
4037 
4038     /**
4039      * Creates an object binding with the first element of an observable set after filtering and mapping.
4040      *
4041      @param items    the observable set of items.
4042      @param supplier a {@code Supplier} whose result is returned if no value is present.
4043      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4044      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4045      *
4046      @return an object binding
4047      */
4048     @Nonnull
4049     public static <T, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<R> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, R> mapper) {
4050         requireNonNull(items, ERROR_ITEMS_NULL);
4051         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4052         requireNonNull(filter, ERROR_FILTER_NULL);
4053         requireNonNull(mapper, ERROR_MAPPER_NULL);
4054         return createObjectBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4055     }
4056 
4057     /**
4058      * Creates an object binding with the first element of an observable set after filtering and mapping.
4059      *
4060      @param items        the observable set of items.
4061      @param defaultValue the value to be returned if there is no value present.
4062      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4063      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4064      *
4065      @return an object binding
4066      */
4067     @Nonnull
4068     public static <T, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final R defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, R>> mapper) {
4069         requireNonNull(items, ERROR_ITEMS_NULL);
4070         requireNonNull(filter, ERROR_FILTER_NULL);
4071         requireNonNull(mapper, ERROR_MAPPER_NULL);
4072         return createObjectBinding(() -> {
4073             Function<? super T, R> mapperValue = mapper.getValue();
4074             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4075             Predicate<? super T> filterValue = filter.getValue();
4076             requireNonNull(filterValue, ERROR_FILTER_NULL);
4077             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4078         }, items, mapper, filter);
4079     }
4080 
4081     /**
4082      * Creates an object binding with the first element of an observable set after filtering and mapping.
4083      *
4084      @param items    the observable set of items.
4085      @param supplier a {@code Supplier} whose result is returned if no value is present.
4086      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4087      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4088      *
4089      @return an object binding
4090      */
4091     @Nonnull
4092     public static <T, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<R> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, R>> mapper) {
4093         requireNonNull(items, ERROR_ITEMS_NULL);
4094         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4095         requireNonNull(filter, ERROR_FILTER_NULL);
4096         requireNonNull(mapper, ERROR_MAPPER_NULL);
4097         return createObjectBinding(() -> {
4098             Function<? super T, R> mapperValue = mapper.getValue();
4099             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4100             Predicate<? super T> filterValue = filter.getValue();
4101             requireNonNull(filterValue, ERROR_FILTER_NULL);
4102             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4103         }, items, mapper, filter);
4104     }
4105 
4106     /**
4107      * Creates a boolean binding with the first element of an observable set after filtering and mapping.
4108      *
4109      @param items        the observable set of items.
4110      @param defaultValue the value to be returned if there is no value present.
4111      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4112      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4113      *
4114      @return a boolean binding
4115      */
4116     @Nonnull
4117     public static <T> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Boolean defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Boolean> mapper) {
4118         requireNonNull(items, ERROR_ITEMS_NULL);
4119         requireNonNull(filter, ERROR_FILTER_NULL);
4120         requireNonNull(mapper, ERROR_MAPPER_NULL);
4121         return createBooleanBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4122     }
4123 
4124     /**
4125      * Creates a boolean binding with the first element of an observable set after filtering and mapping.
4126      *
4127      @param items    the observable set of items.
4128      @param supplier a {@code Supplier} whose result is returned if no value is present.
4129      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4130      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4131      *
4132      @return a boolean binding
4133      */
4134     @Nonnull
4135     public static <T> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Boolean> mapper) {
4136         requireNonNull(items, ERROR_ITEMS_NULL);
4137         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4138         requireNonNull(filter, ERROR_FILTER_NULL);
4139         requireNonNull(mapper, ERROR_MAPPER_NULL);
4140         return createBooleanBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4141     }
4142 
4143     /**
4144      * Creates a boolean binding with the first element of an observable set after filtering and mapping.
4145      *
4146      @param items        the observable set of items.
4147      @param defaultValue the value to be returned if there is no value present.
4148      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4149      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4150      *
4151      @return a boolean binding
4152      */
4153     @Nonnull
4154     public static <T> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Boolean>> mapper) {
4155         requireNonNull(items, ERROR_ITEMS_NULL);
4156         requireNonNull(filter, ERROR_FILTER_NULL);
4157         requireNonNull(mapper, ERROR_MAPPER_NULL);
4158         return createBooleanBinding(() -> {
4159             Function<? super T, Boolean> mapperValue = mapper.getValue();
4160             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4161             Predicate<? super T> filterValue = filter.getValue();
4162             requireNonNull(filterValue, ERROR_FILTER_NULL);
4163             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4164         }, items, mapper, filter);
4165     }
4166 
4167     /**
4168      * Creates a boolean binding with the first element of an observable set after filtering and mapping.
4169      *
4170      @param items    the observable set of items.
4171      @param supplier a {@code Supplier} whose result is returned if no value is present.
4172      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4173      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4174      *
4175      @return a boolean binding
4176      */
4177     @Nonnull
4178     public static <T> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Boolean>> mapper) {
4179         requireNonNull(items, ERROR_ITEMS_NULL);
4180         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4181         requireNonNull(filter, ERROR_FILTER_NULL);
4182         requireNonNull(mapper, ERROR_MAPPER_NULL);
4183         return createBooleanBinding(() -> {
4184             Function<? super T, Boolean> mapperValue = mapper.getValue();
4185             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4186             Predicate<? super T> filterValue = filter.getValue();
4187             requireNonNull(filterValue, ERROR_FILTER_NULL);
4188             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4189         }, items, mapper, filter);
4190     }
4191 
4192     /**
4193      * Creates an integer binding with the first element of an observable set after filtering and mapping.
4194      *
4195      @param items        the observable set of items.
4196      @param defaultValue the value to be returned if there is no value present.
4197      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4198      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4199      *
4200      @return an integer binding
4201      */
4202     @Nonnull
4203     public static <T> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Integer defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Integer> mapper) {
4204         requireNonNull(items, ERROR_ITEMS_NULL);
4205         requireNonNull(filter, ERROR_FILTER_NULL);
4206         requireNonNull(mapper, ERROR_MAPPER_NULL);
4207         return createIntegerBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4208     }
4209 
4210     /**
4211      * Creates an integer binding with the first element of an observable set after filtering and mapping.
4212      *
4213      @param items    the observable set of items.
4214      @param supplier a {@code Supplier} whose result is returned if no value is present.
4215      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4216      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4217      *
4218      @return an integer binding
4219      */
4220     @Nonnull
4221     public static <T> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Integer> mapper) {
4222         requireNonNull(items, ERROR_ITEMS_NULL);
4223         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4224         requireNonNull(filter, ERROR_FILTER_NULL);
4225         requireNonNull(mapper, ERROR_MAPPER_NULL);
4226         return createIntegerBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4227     }
4228 
4229     /**
4230      * Creates an integer binding with the first element of an observable set after filtering and mapping.
4231      *
4232      @param items        the observable set of items.
4233      @param defaultValue the value to be returned if there is no value present.
4234      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4235      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4236      *
4237      @return an integer binding
4238      */
4239     @Nonnull
4240     public static <T> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Integer>> mapper) {
4241         requireNonNull(items, ERROR_ITEMS_NULL);
4242         requireNonNull(filter, ERROR_FILTER_NULL);
4243         requireNonNull(mapper, ERROR_MAPPER_NULL);
4244         return createIntegerBinding(() -> {
4245             Function<? super T, Integer> mapperValue = mapper.getValue();
4246             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4247             Predicate<? super T> filterValue = filter.getValue();
4248             requireNonNull(filterValue, ERROR_FILTER_NULL);
4249             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4250         }, items, mapper, filter);
4251     }
4252 
4253     /**
4254      * Creates an integer binding with the first element of an observable set after filtering and mapping.
4255      *
4256      @param items    the observable set of items.
4257      @param supplier a {@code Supplier} whose result is returned if no value is present.
4258      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4259      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4260      *
4261      @return an integer binding
4262      */
4263     @Nonnull
4264     public static <T> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Integer>> mapper) {
4265         requireNonNull(items, ERROR_ITEMS_NULL);
4266         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4267         requireNonNull(filter, ERROR_FILTER_NULL);
4268         requireNonNull(mapper, ERROR_MAPPER_NULL);
4269         return createIntegerBinding(() -> {
4270             Function<? super T, Integer> mapperValue = mapper.getValue();
4271             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4272             Predicate<? super T> filterValue = filter.getValue();
4273             requireNonNull(filterValue, ERROR_FILTER_NULL);
4274             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4275         }, items, mapper, filter);
4276     }
4277 
4278     /**
4279      * Creates a long binding with the first element of an observable set after filtering and mapping.
4280      *
4281      @param items        the observable set of items.
4282      @param defaultValue the value to be returned if there is no value present.
4283      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4284      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4285      *
4286      @return a long binding
4287      */
4288     @Nonnull
4289     public static <T> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Long defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Long> mapper) {
4290         requireNonNull(items, ERROR_ITEMS_NULL);
4291         requireNonNull(filter, ERROR_FILTER_NULL);
4292         requireNonNull(mapper, ERROR_MAPPER_NULL);
4293         return createLongBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4294     }
4295 
4296     /**
4297      * Creates a long binding with the first element of an observable set after filtering and mapping.
4298      *
4299      @param items    the observable set of items.
4300      @param supplier a {@code Supplier} whose result is returned if no value is present.
4301      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4302      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4303      *
4304      @return a long binding
4305      */
4306     @Nonnull
4307     public static <T> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Long> mapper) {
4308         requireNonNull(items, ERROR_ITEMS_NULL);
4309         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4310         requireNonNull(filter, ERROR_FILTER_NULL);
4311         requireNonNull(mapper, ERROR_MAPPER_NULL);
4312         return createLongBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4313     }
4314 
4315     /**
4316      * Creates a long binding with the first element of an observable set after filtering and mapping.
4317      *
4318      @param items        the observable set of items.
4319      @param defaultValue the value to be returned if there is no value present.
4320      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4321      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4322      *
4323      @return a long binding
4324      */
4325     @Nonnull
4326     public static <T> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Long>> mapper) {
4327         requireNonNull(items, ERROR_ITEMS_NULL);
4328         requireNonNull(filter, ERROR_FILTER_NULL);
4329         requireNonNull(mapper, ERROR_MAPPER_NULL);
4330         return createLongBinding(() -> {
4331             Function<? super T, Long> mapperValue = mapper.getValue();
4332             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4333             Predicate<? super T> filterValue = filter.getValue();
4334             requireNonNull(filterValue, ERROR_FILTER_NULL);
4335             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4336         }, items, mapper, filter);
4337     }
4338 
4339     /**
4340      * Creates a long binding with the first element of an observable set after filtering and mapping.
4341      *
4342      @param items    the observable set of items.
4343      @param supplier a {@code Supplier} whose result is returned if no value is present.
4344      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4345      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4346      *
4347      @return a long binding
4348      */
4349     @Nonnull
4350     public static <T> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Long>> mapper) {
4351         requireNonNull(items, ERROR_ITEMS_NULL);
4352         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4353         requireNonNull(filter, ERROR_FILTER_NULL);
4354         requireNonNull(mapper, ERROR_MAPPER_NULL);
4355         return createLongBinding(() -> {
4356             Function<? super T, Long> mapperValue = mapper.getValue();
4357             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4358             Predicate<? super T> filterValue = filter.getValue();
4359             requireNonNull(filterValue, ERROR_FILTER_NULL);
4360             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4361         }, items, mapper, filter);
4362     }
4363 
4364     /**
4365      * Creates a float binding with the first element of an observable set after filtering and mapping.
4366      *
4367      @param items        the observable set of items.
4368      @param defaultValue the value to be returned if there is no value present.
4369      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4370      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4371      *
4372      @return a float binding
4373      */
4374     @Nonnull
4375     public static <T> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Float defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Float> mapper) {
4376         requireNonNull(items, ERROR_ITEMS_NULL);
4377         requireNonNull(filter, ERROR_FILTER_NULL);
4378         requireNonNull(mapper, ERROR_MAPPER_NULL);
4379         return createFloatBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4380     }
4381 
4382     /**
4383      * Creates a float binding with the first element of an observable set after filtering and mapping.
4384      *
4385      @param items    the observable set of items.
4386      @param supplier a {@code Supplier} whose result is returned if no value is present.
4387      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4388      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4389      *
4390      @return a float binding
4391      */
4392     @Nonnull
4393     public static <T> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Float> mapper) {
4394         requireNonNull(items, ERROR_ITEMS_NULL);
4395         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4396         requireNonNull(filter, ERROR_FILTER_NULL);
4397         requireNonNull(mapper, ERROR_MAPPER_NULL);
4398         return createFloatBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4399     }
4400 
4401     /**
4402      * Creates a float binding with the first element of an observable set after filtering and mapping.
4403      *
4404      @param items        the observable set of items.
4405      @param defaultValue the value to be returned if there is no value present.
4406      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4407      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4408      *
4409      @return a float binding
4410      */
4411     @Nonnull
4412     public static <T> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Float>> mapper) {
4413         requireNonNull(items, ERROR_ITEMS_NULL);
4414         requireNonNull(filter, ERROR_FILTER_NULL);
4415         requireNonNull(mapper, ERROR_MAPPER_NULL);
4416         return createFloatBinding(() -> {
4417             Function<? super T, Float> mapperValue = mapper.getValue();
4418             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4419             Predicate<? super T> filterValue = filter.getValue();
4420             requireNonNull(filterValue, ERROR_FILTER_NULL);
4421             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4422         }, items, mapper, filter);
4423     }
4424 
4425     /**
4426      * Creates a float binding with the first element of an observable set after filtering and mapping.
4427      *
4428      @param items    the observable set of items.
4429      @param supplier a {@code Supplier} whose result is returned if no value is present.
4430      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4431      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4432      *
4433      @return a float binding
4434      */
4435     @Nonnull
4436     public static <T> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Float>> mapper) {
4437         requireNonNull(items, ERROR_ITEMS_NULL);
4438         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4439         requireNonNull(filter, ERROR_FILTER_NULL);
4440         requireNonNull(mapper, ERROR_MAPPER_NULL);
4441         return createFloatBinding(() -> {
4442             Function<? super T, Float> mapperValue = mapper.getValue();
4443             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4444             Predicate<? super T> filterValue = filter.getValue();
4445             requireNonNull(filterValue, ERROR_FILTER_NULL);
4446             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4447         }, items, mapper, filter);
4448     }
4449 
4450     /**
4451      * Creates a double binding with the first element of an observable set after filtering and mapping.
4452      *
4453      @param items        the observable set of items.
4454      @param defaultValue the value to be returned if there is no value present.
4455      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4456      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4457      *
4458      @return a double binding
4459      */
4460     @Nonnull
4461     public static <T> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Double defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Double> mapper) {
4462         requireNonNull(items, ERROR_ITEMS_NULL);
4463         requireNonNull(filter, ERROR_FILTER_NULL);
4464         requireNonNull(mapper, ERROR_MAPPER_NULL);
4465         return createDoubleBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4466     }
4467 
4468     /**
4469      * Creates a double binding with the first element of an observable set after filtering and mapping.
4470      *
4471      @param items    the observable set of items.
4472      @param supplier a {@code Supplier} whose result is returned if no value is present.
4473      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4474      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4475      *
4476      @return a double binding
4477      */
4478     @Nonnull
4479     public static <T> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, Double> mapper) {
4480         requireNonNull(items, ERROR_ITEMS_NULL);
4481         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4482         requireNonNull(filter, ERROR_FILTER_NULL);
4483         requireNonNull(mapper, ERROR_MAPPER_NULL);
4484         return createDoubleBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4485     }
4486 
4487     /**
4488      * Creates a double binding with the first element of an observable set after filtering and mapping.
4489      *
4490      @param items        the observable set of items.
4491      @param defaultValue the value to be returned if there is no value present.
4492      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4493      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4494      *
4495      @return a double binding
4496      */
4497     @Nonnull
4498     public static <T> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Double>> mapper) {
4499         requireNonNull(items, ERROR_ITEMS_NULL);
4500         requireNonNull(filter, ERROR_FILTER_NULL);
4501         requireNonNull(mapper, ERROR_MAPPER_NULL);
4502         return createDoubleBinding(() -> {
4503             Function<? super T, Double> mapperValue = mapper.getValue();
4504             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4505             Predicate<? super T> filterValue = filter.getValue();
4506             requireNonNull(filterValue, ERROR_FILTER_NULL);
4507             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4508         }, items, mapper, filter);
4509     }
4510 
4511     /**
4512      * Creates a double binding with the first element of an observable set after filtering and mapping.
4513      *
4514      @param items    the observable set of items.
4515      @param supplier a {@code Supplier} whose result is returned if no value is present.
4516      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4517      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4518      *
4519      @return a double binding
4520      */
4521     @Nonnull
4522     public static <T> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, Double>> mapper) {
4523         requireNonNull(items, ERROR_ITEMS_NULL);
4524         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4525         requireNonNull(filter, ERROR_FILTER_NULL);
4526         requireNonNull(mapper, ERROR_MAPPER_NULL);
4527         return createDoubleBinding(() -> {
4528             Function<? super T, Double> mapperValue = mapper.getValue();
4529             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4530             Predicate<? super T> filterValue = filter.getValue();
4531             requireNonNull(filterValue, ERROR_FILTER_NULL);
4532             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4533         }, items, mapper, filter);
4534     }
4535 
4536     /**
4537      * Creates a string binding with the first element of an observable set after filtering and mapping.
4538      *
4539      @param items        the observable set of items.
4540      @param defaultValue the value to be returned if there is no value present.
4541      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4542      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4543      *
4544      @return a string binding
4545      */
4546     @Nonnull
4547     public static <T> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final String defaultValue, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, String> mapper) {
4548         requireNonNull(items, ERROR_ITEMS_NULL);
4549         requireNonNull(filter, ERROR_FILTER_NULL);
4550         requireNonNull(mapper, ERROR_MAPPER_NULL);
4551         return createStringBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4552     }
4553 
4554     /**
4555      * Creates a string binding with the first element of an observable set after filtering and mapping.
4556      *
4557      @param items    the observable set of items.
4558      @param supplier a {@code Supplier} whose result is returned if no value is present.
4559      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4560      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4561      *
4562      @return a string binding
4563      */
4564     @Nonnull
4565     public static <T> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<String> supplier, @Nonnull final Predicate<? super T> filter, @Nonnull final Function<? super T, String> mapper) {
4566         requireNonNull(items, ERROR_ITEMS_NULL);
4567         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4568         requireNonNull(filter, ERROR_FILTER_NULL);
4569         requireNonNull(mapper, ERROR_MAPPER_NULL);
4570         return createStringBinding(() -> items.stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4571     }
4572 
4573     /**
4574      * Creates a string binding with the first element of an observable set after filtering and mapping.
4575      *
4576      @param items        the observable set of items.
4577      @param defaultValue the value to be returned if there is no value present.
4578      @param filter       a non-interfering, stateless predicate to apply to the each element. before mapping.
4579      @param mapper       a non-interfering, stateless function to apply to the each element after filtering.
4580      *
4581      @return a string binding
4582      */
4583     @Nonnull
4584     public static <T> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, String>> mapper) {
4585         requireNonNull(items, ERROR_ITEMS_NULL);
4586         requireNonNull(filter, ERROR_FILTER_NULL);
4587         requireNonNull(mapper, ERROR_MAPPER_NULL);
4588         return createStringBinding(() -> {
4589             Function<? super T, String> mapperValue = mapper.getValue();
4590             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4591             Predicate<? super T> filterValue = filter.getValue();
4592             requireNonNull(filterValue, ERROR_FILTER_NULL);
4593             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4594         }, items, mapper, filter);
4595     }
4596 
4597     /**
4598      * Creates a string binding with the first element of an observable set after filtering and mapping.
4599      *
4600      @param items    the observable set of items.
4601      @param supplier a {@code Supplier} whose result is returned if no value is present.
4602      @param filter   a non-interfering, stateless predicate to apply to the each element. before mapping.
4603      @param mapper   a non-interfering, stateless function to apply to the each element after filtering.
4604      *
4605      @return a string binding
4606      */
4607     @Nonnull
4608     public static <T> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableSet<T> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Predicate<? super T>> filter, @Nonnull final ObservableValue<Function<? super T, String>> mapper) {
4609         requireNonNull(items, ERROR_ITEMS_NULL);
4610         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4611         requireNonNull(filter, ERROR_FILTER_NULL);
4612         requireNonNull(mapper, ERROR_MAPPER_NULL);
4613         return createStringBinding(() -> {
4614             Function<? super T, String> mapperValue = mapper.getValue();
4615             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4616             Predicate<? super T> filterValue = filter.getValue();
4617             requireNonNull(filterValue, ERROR_FILTER_NULL);
4618             return items.stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4619         }, items, mapper, filter);
4620     }
4621 
4622     /**
4623      * Creates an object binding with the first value of an observable map after filtering and mapping.
4624      *
4625      @param items        the observable map of items.
4626      @param defaultValue the value to be returned if there is no value present.
4627      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4628      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4629      *
4630      @return an object binding
4631      */
4632     @Nonnull
4633     public static <K, V, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final R defaultValue, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, R> mapper) {
4634         requireNonNull(items, ERROR_ITEMS_NULL);
4635         requireNonNull(filter, ERROR_FILTER_NULL);
4636         requireNonNull(mapper, ERROR_MAPPER_NULL);
4637         return createObjectBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4638     }
4639 
4640     /**
4641      * Creates an object binding with the first value of an observable map after filtering and mapping.
4642      *
4643      @param items    the observable map of items.
4644      @param supplier a {@code Supplier} whose result is returned if no value is present.
4645      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4646      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4647      *
4648      @return an object binding
4649      */
4650     @Nonnull
4651     public static <K, V, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<R> supplier, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, R> mapper) {
4652         requireNonNull(items, ERROR_ITEMS_NULL);
4653         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4654         requireNonNull(filter, ERROR_FILTER_NULL);
4655         requireNonNull(mapper, ERROR_MAPPER_NULL);
4656         return createObjectBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4657     }
4658 
4659     /**
4660      * Creates an object binding with the first value of an observable map after filtering and mapping.
4661      *
4662      @param items        the observable map of items.
4663      @param defaultValue the value to be returned if there is no value present.
4664      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4665      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4666      *
4667      @return an object binding
4668      */
4669     @Nonnull
4670     public static <K, V, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final R defaultValue, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, R>> mapper) {
4671         requireNonNull(items, ERROR_ITEMS_NULL);
4672         requireNonNull(filter, ERROR_FILTER_NULL);
4673         requireNonNull(mapper, ERROR_MAPPER_NULL);
4674         return createObjectBinding(() -> {
4675             Function<? super V, R> mapperValue = mapper.getValue();
4676             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4677             Predicate<? super V> filterValue = filter.getValue();
4678             requireNonNull(filterValue, ERROR_FILTER_NULL);
4679             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4680         }, items, mapper, filter);
4681     }
4682 
4683     /**
4684      * Creates an object binding with the first value of an observable map after filtering and mapping.
4685      *
4686      @param items    the observable map of items.
4687      @param supplier a {@code Supplier} whose result is returned if no value is present.
4688      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4689      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4690      *
4691      @return an object binding
4692      */
4693     @Nonnull
4694     public static <K, V, R> ObjectBinding<R> filterThenMapThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<R> supplier, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, R>> mapper) {
4695         requireNonNull(items, ERROR_ITEMS_NULL);
4696         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4697         requireNonNull(filter, ERROR_FILTER_NULL);
4698         requireNonNull(mapper, ERROR_MAPPER_NULL);
4699         return createObjectBinding(() -> {
4700             Function<? super V, R> mapperValue = mapper.getValue();
4701             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4702             Predicate<? super V> filterValue = filter.getValue();
4703             requireNonNull(filterValue, ERROR_FILTER_NULL);
4704             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4705         }, items, mapper, filter);
4706     }
4707 
4708     /**
4709      * Creates a boolean binding with the first value of an observable map after filtering and mapping.
4710      *
4711      @param items        the observable map of items.
4712      @param defaultValue the value to be returned if there is no value present.
4713      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4714      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4715      *
4716      @return a boolean binding
4717      */
4718     @Nonnull
4719     public static <K, V> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Boolean defaultValue, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Boolean> mapper) {
4720         requireNonNull(items, ERROR_ITEMS_NULL);
4721         requireNonNull(filter, ERROR_FILTER_NULL);
4722         requireNonNull(mapper, ERROR_MAPPER_NULL);
4723         return createBooleanBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4724     }
4725 
4726     /**
4727      * Creates a boolean binding with the first value of an observable map after filtering and mapping.
4728      *
4729      @param items    the observable map of items.
4730      @param supplier a {@code Supplier} whose result is returned if no value is present.
4731      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4732      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4733      *
4734      @return a boolean binding
4735      */
4736     @Nonnull
4737     public static <K, V> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Boolean> mapper) {
4738         requireNonNull(items, ERROR_ITEMS_NULL);
4739         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4740         requireNonNull(filter, ERROR_FILTER_NULL);
4741         requireNonNull(mapper, ERROR_MAPPER_NULL);
4742         return createBooleanBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4743     }
4744 
4745     /**
4746      * Creates a boolean binding with the first value of an observable map after filtering and mapping.
4747      *
4748      @param items        the observable map of items.
4749      @param defaultValue the value to be returned if there is no value present.
4750      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4751      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4752      *
4753      @return a boolean binding
4754      */
4755     @Nonnull
4756     public static <K, V> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Boolean defaultValue, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Boolean>> mapper) {
4757         requireNonNull(items, ERROR_ITEMS_NULL);
4758         requireNonNull(filter, ERROR_FILTER_NULL);
4759         requireNonNull(mapper, ERROR_MAPPER_NULL);
4760         return createBooleanBinding(() -> {
4761             Function<? super V, Boolean> mapperValue = mapper.getValue();
4762             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4763             Predicate<? super V> filterValue = filter.getValue();
4764             requireNonNull(filterValue, ERROR_FILTER_NULL);
4765             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4766         }, items, mapper, filter);
4767     }
4768 
4769     /**
4770      * Creates a boolean binding with the first value of an observable map after filtering and mapping.
4771      *
4772      @param items    the observable map of items.
4773      @param supplier a {@code Supplier} whose result is returned if no value is present.
4774      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4775      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4776      *
4777      @return a boolean binding
4778      */
4779     @Nonnull
4780     public static <K, V> BooleanBinding filterThenMapToBooleanThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Boolean> supplier, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Boolean>> mapper) {
4781         requireNonNull(items, ERROR_ITEMS_NULL);
4782         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4783         requireNonNull(filter, ERROR_FILTER_NULL);
4784         requireNonNull(mapper, ERROR_MAPPER_NULL);
4785         return createBooleanBinding(() -> {
4786             Function<? super V, Boolean> mapperValue = mapper.getValue();
4787             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4788             Predicate<? super V> filterValue = filter.getValue();
4789             requireNonNull(filterValue, ERROR_FILTER_NULL);
4790             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4791         }, items, mapper, filter);
4792     }
4793 
4794     /**
4795      * Creates an integer binding with the first value of an observable map after filtering and mapping.
4796      *
4797      @param items        the observable map of items.
4798      @param defaultValue the value to be returned if there is no value present.
4799      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4800      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4801      *
4802      @return an integer binding
4803      */
4804     @Nonnull
4805     public static <K, V> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Integer defaultValue, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Integer> mapper) {
4806         requireNonNull(items, ERROR_ITEMS_NULL);
4807         requireNonNull(filter, ERROR_FILTER_NULL);
4808         requireNonNull(mapper, ERROR_MAPPER_NULL);
4809         return createIntegerBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4810     }
4811 
4812     /**
4813      * Creates an integer binding with the first value of an observable map after filtering and mapping.
4814      *
4815      @param items    the observable map of items.
4816      @param supplier a {@code Supplier} whose result is returned if no value is present.
4817      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4818      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4819      *
4820      @return an integer binding
4821      */
4822     @Nonnull
4823     public static <K, V> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Integer> mapper) {
4824         requireNonNull(items, ERROR_ITEMS_NULL);
4825         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4826         requireNonNull(filter, ERROR_FILTER_NULL);
4827         requireNonNull(mapper, ERROR_MAPPER_NULL);
4828         return createIntegerBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4829     }
4830 
4831     /**
4832      * Creates an integer binding with the first value of an observable map after filtering and mapping.
4833      *
4834      @param items        the observable map of items.
4835      @param defaultValue the value to be returned if there is no value present.
4836      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4837      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4838      *
4839      @return an integer binding
4840      */
4841     @Nonnull
4842     public static <K, V> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Integer defaultValue, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Integer>> mapper) {
4843         requireNonNull(items, ERROR_ITEMS_NULL);
4844         requireNonNull(filter, ERROR_FILTER_NULL);
4845         requireNonNull(mapper, ERROR_MAPPER_NULL);
4846         return createIntegerBinding(() -> {
4847             Function<? super V, Integer> mapperValue = mapper.getValue();
4848             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4849             Predicate<? super V> filterValue = filter.getValue();
4850             requireNonNull(filterValue, ERROR_FILTER_NULL);
4851             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4852         }, items, mapper, filter);
4853     }
4854 
4855     /**
4856      * Creates an integer binding with the first value of an observable map after filtering and mapping.
4857      *
4858      @param items    the observable map of items.
4859      @param supplier a {@code Supplier} whose result is returned if no value is present.
4860      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4861      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4862      *
4863      @return an integer binding
4864      */
4865     @Nonnull
4866     public static <K, V> IntegerBinding filterThenMapToIntegerThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Integer> supplier, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Integer>> mapper) {
4867         requireNonNull(items, ERROR_ITEMS_NULL);
4868         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4869         requireNonNull(filter, ERROR_FILTER_NULL);
4870         requireNonNull(mapper, ERROR_MAPPER_NULL);
4871         return createIntegerBinding(() -> {
4872             Function<? super V, Integer> mapperValue = mapper.getValue();
4873             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4874             Predicate<? super V> filterValue = filter.getValue();
4875             requireNonNull(filterValue, ERROR_FILTER_NULL);
4876             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4877         }, items, mapper, filter);
4878     }
4879 
4880     /**
4881      * Creates a long binding with the first value of an observable map after filtering and mapping.
4882      *
4883      @param items        the observable map of items.
4884      @param defaultValue the value to be returned if there is no value present.
4885      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4886      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4887      *
4888      @return a long binding
4889      */
4890     @Nonnull
4891     public static <K, V> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Long defaultValue, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Long> mapper) {
4892         requireNonNull(items, ERROR_ITEMS_NULL);
4893         requireNonNull(filter, ERROR_FILTER_NULL);
4894         requireNonNull(mapper, ERROR_MAPPER_NULL);
4895         return createLongBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4896     }
4897 
4898     /**
4899      * Creates a long binding with the first value of an observable map after filtering and mapping.
4900      *
4901      @param items    the observable map of items.
4902      @param supplier a {@code Supplier} whose result is returned if no value is present.
4903      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4904      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4905      *
4906      @return a long binding
4907      */
4908     @Nonnull
4909     public static <K, V> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Long> supplier, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Long> mapper) {
4910         requireNonNull(items, ERROR_ITEMS_NULL);
4911         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4912         requireNonNull(filter, ERROR_FILTER_NULL);
4913         requireNonNull(mapper, ERROR_MAPPER_NULL);
4914         return createLongBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
4915     }
4916 
4917     /**
4918      * Creates a long binding with the first value of an observable map after filtering and mapping.
4919      *
4920      @param items        the observable map of items.
4921      @param defaultValue the value to be returned if there is no value present.
4922      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4923      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4924      *
4925      @return a long binding
4926      */
4927     @Nonnull
4928     public static <K, V> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Long defaultValue, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Long>> mapper) {
4929         requireNonNull(items, ERROR_ITEMS_NULL);
4930         requireNonNull(filter, ERROR_FILTER_NULL);
4931         requireNonNull(mapper, ERROR_MAPPER_NULL);
4932         return createLongBinding(() -> {
4933             Function<? super V, Long> mapperValue = mapper.getValue();
4934             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4935             Predicate<? super V> filterValue = filter.getValue();
4936             requireNonNull(filterValue, ERROR_FILTER_NULL);
4937             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
4938         }, items, mapper, filter);
4939     }
4940 
4941     /**
4942      * Creates a long binding with the first value of an observable map after filtering and mapping.
4943      *
4944      @param items    the observable map of items.
4945      @param supplier a {@code Supplier} whose result is returned if no value is present.
4946      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4947      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4948      *
4949      @return a long binding
4950      */
4951     @Nonnull
4952     public static <K, V> LongBinding filterThenMapToLongThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Long> supplier, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Long>> mapper) {
4953         requireNonNull(items, ERROR_ITEMS_NULL);
4954         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4955         requireNonNull(filter, ERROR_FILTER_NULL);
4956         requireNonNull(mapper, ERROR_MAPPER_NULL);
4957         return createLongBinding(() -> {
4958             Function<? super V, Long> mapperValue = mapper.getValue();
4959             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
4960             Predicate<? super V> filterValue = filter.getValue();
4961             requireNonNull(filterValue, ERROR_FILTER_NULL);
4962             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
4963         }, items, mapper, filter);
4964     }
4965 
4966     /**
4967      * Creates a float binding with the first value of an observable map after filtering and mapping.
4968      *
4969      @param items        the observable map of items.
4970      @param defaultValue the value to be returned if there is no value present.
4971      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
4972      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
4973      *
4974      @return a float binding
4975      */
4976     @Nonnull
4977     public static <K, V> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Float defaultValue, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Float> mapper) {
4978         requireNonNull(items, ERROR_ITEMS_NULL);
4979         requireNonNull(filter, ERROR_FILTER_NULL);
4980         requireNonNull(mapper, ERROR_MAPPER_NULL);
4981         return createFloatBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
4982     }
4983 
4984     /**
4985      * Creates a float binding with the first value of an observable map after filtering and mapping.
4986      *
4987      @param items    the observable map of items.
4988      @param supplier a {@code Supplier} whose result is returned if no value is present.
4989      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
4990      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
4991      *
4992      @return a float binding
4993      */
4994     @Nonnull
4995     public static <K, V> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Float> supplier, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Float> mapper) {
4996         requireNonNull(items, ERROR_ITEMS_NULL);
4997         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
4998         requireNonNull(filter, ERROR_FILTER_NULL);
4999         requireNonNull(mapper, ERROR_MAPPER_NULL);
5000         return createFloatBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
5001     }
5002 
5003     /**
5004      * Creates a float binding with the first value of an observable map after filtering and mapping.
5005      *
5006      @param items        the observable map of items.
5007      @param defaultValue the value to be returned if there is no value present.
5008      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
5009      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
5010      *
5011      @return a float binding
5012      */
5013     @Nonnull
5014     public static <K, V> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Float defaultValue, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Float>> mapper) {
5015         requireNonNull(items, ERROR_ITEMS_NULL);
5016         requireNonNull(filter, ERROR_FILTER_NULL);
5017         requireNonNull(mapper, ERROR_MAPPER_NULL);
5018         return createFloatBinding(() -> {
5019             Function<? super V, Float> mapperValue = mapper.getValue();
5020             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
5021             Predicate<? super V> filterValue = filter.getValue();
5022             requireNonNull(filterValue, ERROR_FILTER_NULL);
5023             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
5024         }, items, mapper, filter);
5025     }
5026 
5027     /**
5028      * Creates a float binding with the first value of an observable map after filtering and mapping.
5029      *
5030      @param items    the observable map of items.
5031      @param supplier a {@code Supplier} whose result is returned if no value is present.
5032      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
5033      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
5034      *
5035      @return a float binding
5036      */
5037     @Nonnull
5038     public static <K, V> FloatBinding filterThenMapToFloatThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Float> supplier, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Float>> mapper) {
5039         requireNonNull(items, ERROR_ITEMS_NULL);
5040         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
5041         requireNonNull(filter, ERROR_FILTER_NULL);
5042         requireNonNull(mapper, ERROR_MAPPER_NULL);
5043         return createFloatBinding(() -> {
5044             Function<? super V, Float> mapperValue = mapper.getValue();
5045             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
5046             Predicate<? super V> filterValue = filter.getValue();
5047             requireNonNull(filterValue, ERROR_FILTER_NULL);
5048             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
5049         }, items, mapper, filter);
5050     }
5051 
5052     /**
5053      * Creates a double binding with the first value of an observable map after filtering and mapping.
5054      *
5055      @param items        the observable map of items.
5056      @param defaultValue the value to be returned if there is no value present.
5057      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
5058      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
5059      *
5060      @return a double binding
5061      */
5062     @Nonnull
5063     public static <K, V> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Double defaultValue, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Double> mapper) {
5064         requireNonNull(items, ERROR_ITEMS_NULL);
5065         requireNonNull(filter, ERROR_FILTER_NULL);
5066         requireNonNull(mapper, ERROR_MAPPER_NULL);
5067         return createDoubleBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
5068     }
5069 
5070     /**
5071      * Creates a double binding with the first value of an observable map after filtering and mapping.
5072      *
5073      @param items    the observable map of items.
5074      @param supplier a {@code Supplier} whose result is returned if no value is present.
5075      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
5076      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
5077      *
5078      @return a double binding
5079      */
5080     @Nonnull
5081     public static <K, V> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Double> supplier, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, Double> mapper) {
5082         requireNonNull(items, ERROR_ITEMS_NULL);
5083         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
5084         requireNonNull(filter, ERROR_FILTER_NULL);
5085         requireNonNull(mapper, ERROR_MAPPER_NULL);
5086         return createDoubleBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
5087     }
5088 
5089     /**
5090      * Creates a double binding with the first value of an observable map after filtering and mapping.
5091      *
5092      @param items        the observable map of items.
5093      @param defaultValue the value to be returned if there is no value present.
5094      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
5095      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
5096      *
5097      @return a double binding
5098      */
5099     @Nonnull
5100     public static <K, V> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Double defaultValue, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Double>> mapper) {
5101         requireNonNull(items, ERROR_ITEMS_NULL);
5102         requireNonNull(filter, ERROR_FILTER_NULL);
5103         requireNonNull(mapper, ERROR_MAPPER_NULL);
5104         return createDoubleBinding(() -> {
5105             Function<? super V, Double> mapperValue = mapper.getValue();
5106             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
5107             Predicate<? super V> filterValue = filter.getValue();
5108             requireNonNull(filterValue, ERROR_FILTER_NULL);
5109             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
5110         }, items, mapper, filter);
5111     }
5112 
5113     /**
5114      * Creates a double binding with the first value of an observable map after filtering and mapping.
5115      *
5116      @param items    the observable map of items.
5117      @param supplier a {@code Supplier} whose result is returned if no value is present.
5118      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
5119      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
5120      *
5121      @return a double binding
5122      */
5123     @Nonnull
5124     public static <K, V> DoubleBinding filterThenMapToDoubleThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<Double> supplier, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, Double>> mapper) {
5125         requireNonNull(items, ERROR_ITEMS_NULL);
5126         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
5127         requireNonNull(filter, ERROR_FILTER_NULL);
5128         requireNonNull(mapper, ERROR_MAPPER_NULL);
5129         return createDoubleBinding(() -> {
5130             Function<? super V, Double> mapperValue = mapper.getValue();
5131             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
5132             Predicate<? super V> filterValue = filter.getValue();
5133             requireNonNull(filterValue, ERROR_FILTER_NULL);
5134             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
5135         }, items, mapper, filter);
5136     }
5137 
5138     /**
5139      * Creates a string binding with the first value of an observable map after filtering and mapping.
5140      *
5141      @param items        the observable map of items.
5142      @param defaultValue the value to be returned if there is no value present.
5143      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
5144      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
5145      *
5146      @return a string binding
5147      */
5148     @Nonnull
5149     public static <K, V> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final String defaultValue, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, String> mapper) {
5150         requireNonNull(items, ERROR_ITEMS_NULL);
5151         requireNonNull(filter, ERROR_FILTER_NULL);
5152         requireNonNull(mapper, ERROR_MAPPER_NULL);
5153         return createStringBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElse(defaultValue), items);
5154     }
5155 
5156     /**
5157      * Creates a string binding with the first value of an observable map after filtering and mapping.
5158      *
5159      @param items    the observable map of items.
5160      @param supplier a {@code Supplier} whose result is returned if no value is present.
5161      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
5162      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
5163      *
5164      @return a string binding
5165      */
5166     @Nonnull
5167     public static <K, V> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<String> supplier, @Nonnull final Predicate<? super V> filter, @Nonnull final Function<? super V, String> mapper) {
5168         requireNonNull(items, ERROR_ITEMS_NULL);
5169         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
5170         requireNonNull(filter, ERROR_FILTER_NULL);
5171         requireNonNull(mapper, ERROR_MAPPER_NULL);
5172         return createStringBinding(() -> items.values().stream().filter(filter).map(mapper).findFirst().orElseGet(supplier), items);
5173     }
5174 
5175     /**
5176      * Creates a string binding with the first value of an observable map after filtering and mapping.
5177      *
5178      @param items        the observable map of items.
5179      @param defaultValue the value to be returned if there is no value present.
5180      @param filter       a non-interfering, stateless predicate to apply to the each value before mapping.
5181      @param mapper       a non-interfering, stateless function to apply to the each value after filtering.
5182      *
5183      @return a string binding
5184      */
5185     @Nonnull
5186     public static <K, V> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final String defaultValue, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, String>> mapper) {
5187         requireNonNull(items, ERROR_ITEMS_NULL);
5188         requireNonNull(filter, ERROR_FILTER_NULL);
5189         requireNonNull(mapper, ERROR_MAPPER_NULL);
5190         return createStringBinding(() -> {
5191             Function<? super V, String> mapperValue = mapper.getValue();
5192             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
5193             Predicate<? super V> filterValue = filter.getValue();
5194             requireNonNull(filterValue, ERROR_FILTER_NULL);
5195             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElse(defaultValue);
5196         }, items, mapper, filter);
5197     }
5198 
5199     /**
5200      * Creates a string binding with the first value of an observable map after filtering and mapping.
5201      *
5202      @param items    the observable map of items.
5203      @param supplier a {@code Supplier} whose result is returned if no value is present.
5204      @param filter   a non-interfering, stateless predicate to apply to the each value before mapping.
5205      @param mapper   a non-interfering, stateless function to apply to the each value after filtering.
5206      *
5207      @return a string binding
5208      */
5209     @Nonnull
5210     public static <K, V> StringBinding filterThenMapToStringThenFindFirst(@Nonnull final ObservableMap<K, V> items, @Nonnull final Supplier<String> supplier, @Nonnull final ObservableValue<Predicate<? super V>> filter, @Nonnull final ObservableValue<Function<? super V, String>> mapper) {
5211         requireNonNull(items, ERROR_ITEMS_NULL);
5212         requireNonNull(supplier, ERROR_SUPPLIER_NULL);
5213         requireNonNull(filter, ERROR_FILTER_NULL);
5214         requireNonNull(mapper, ERROR_MAPPER_NULL);
5215         return createStringBinding(() -> {
5216             Function<? super V, String> mapperValue = mapper.getValue();
5217             requireNonNull(mapperValue, ERROR_MAPPER_NULL);
5218             Predicate<? super V> filterValue = filter.getValue();
5219             requireNonNull(filterValue, ERROR_FILTER_NULL);
5220             return items.values().stream().filter(filterValue).map(mapperValue).findFirst().orElseGet(supplier);
5221         }, items, mapper, filter);
5222     }
5223 }