changeset 3762:c200cd542665

Replaced lambdas in FilteredList and TransformationList with anonymous classes.
author Martin Sladecek <martin.sladecek@oracle.com>
date Thu, 30 May 2013 08:19:27 +0200
parents 3e330c5301c2
children 8018a7293402 f2583a30a508
files javafx-beans/src/javafx/collections/transformation/FilteredList.java javafx-beans/src/javafx/collections/transformation/TransformationList.java
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-beans/src/javafx/collections/transformation/FilteredList.java	Wed May 29 23:46:42 2013 -0400
+++ b/javafx-beans/src/javafx/collections/transformation/FilteredList.java	Thu May 30 08:19:27 2013 +0200
@@ -51,6 +51,14 @@
     private int size;
 
     private SortHelper helper;
+    private static final Predicate ALWAYS_TRUE = new Predicate() {
+
+        @Override
+        public boolean test(Object t) {
+            return true;
+        }
+
+    };
 
     /**
      * Constructs a new FilteredList wrapper around the source list.
@@ -77,7 +85,7 @@
      * @param source the source list
      */
     public FilteredList(ObservableList<E> source) {
-        this(source, e -> true);
+        this(source, ALWAYS_TRUE);
     }
 
     /**
@@ -85,14 +93,14 @@
      * Elements not matching the predicate will be filtered-out.
      */
     private final ObjectProperty<Predicate<? super E>> predicate =
-            new ObjectPropertyBase<Predicate<? super E>>(e -> true) {
+            new ObjectPropertyBase<Predicate<? super E>>(ALWAYS_TRUE) {
 
         @Override
         protected void invalidated() {
             if (get() == null) {
                 if (isBound()) {
                     unbind();
-                    set(e -> true);
+                    set(ALWAYS_TRUE);
                     throw new IllegalArgumentException("Predicate cannot be null.");
 
                 }
--- a/javafx-beans/src/javafx/collections/transformation/TransformationList.java	Wed May 29 23:46:42 2013 -0400
+++ b/javafx-beans/src/javafx/collections/transformation/TransformationList.java	Thu May 30 08:19:27 2013 +0200
@@ -101,8 +101,12 @@
 
     private ListChangeListener<F> getListener() {
         if (sourceListener == null) {
-            sourceListener = (Change<? extends F> c) -> {
-                TransformationList.this.sourceChanged(c);
+            sourceListener = new ListChangeListener<F>() {
+
+                @Override
+                public void onChanged(Change<? extends F> c) {
+                    TransformationList.this.sourceChanged(c);
+                }
             };
         }
         return sourceListener;