Simplify code using Java 8 features
[controller.git] / opendaylight / md-sal / sal-dom-compat / src / main / java / org / opendaylight / controller / sal / core / compat / LegacyDOMDataBrokerAdapter.java
index 7f11d5f..6ae6116 100644 (file)
@@ -42,8 +42,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.MappingCheckedFuture;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistration;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
@@ -98,9 +96,9 @@ public class LegacyDOMDataBrokerAdapter extends ForwardingObject implements DOMD
                     final org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener delegateListener;
                     if (listener instanceof ClusteredDOMDataTreeChangeListener) {
                         delegateListener = (org.opendaylight.mdsal.dom.api.ClusteredDOMDataTreeChangeListener)
-                            changes -> listener.onDataTreeChanged(changes);
+                            listener::onDataTreeChanged;
                     } else {
-                        delegateListener = changes -> listener.onDataTreeChanged(changes);
+                        delegateListener = listener::onDataTreeChanged;
                     }
 
                     final ListenerRegistration<org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener> reg =
@@ -127,13 +125,7 @@ public class LegacyDOMDataBrokerAdapter extends ForwardingObject implements DOMD
                 (org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistry) delegateExtensions.get(
                         org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistry.class);
         if (delegateCohortRegistry != null) {
-            extBuilder.put(DOMDataTreeCommitCohortRegistry.class, new DOMDataTreeCommitCohortRegistry() {
-                @Override
-                public <T extends DOMDataTreeCommitCohort> DOMDataTreeCommitCohortRegistration<T> registerCommitCohort(
-                        org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier path, T cohort) {
-                    return delegateCohortRegistry.registerCommitCohort(path, cohort);
-                }
-            });
+            extBuilder.put(DOMDataTreeCommitCohortRegistry.class, delegateCohortRegistry::registerCommitCohort);
         }
 
         extensions = extBuilder.build();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.