Use lambdas instead of anonymous classes
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / AbstractSchemaContext.java
index b760620dcf6b971380c897deccfbc9cbfee50aed..737461b873a11cdc25c48928b4d7e9cd91916f3c 100644 (file)
@@ -41,25 +41,16 @@ import org.opendaylight.yangtools.yang.model.api.UsesNode;
 
 
 public abstract class AbstractSchemaContext implements SchemaContext {
-
-    protected static final Supplier<TreeSet<Module>> MODULE_SET_SUPPLIER = new Supplier<TreeSet<Module>>() {
-        @Override
-        public TreeSet<Module> get() {
-            return new TreeSet<>(REVISION_COMPARATOR);
+    protected static final Comparator<Module> REVISION_COMPARATOR = (o1, o2) -> {
+        if (o2.getRevision() == null) {
+            return -1;
         }
-    };
-
-    protected static final Comparator<Module> REVISION_COMPARATOR = new Comparator<Module>() {
-        @Override
-        public int compare(final Module o1, final Module o2) {
-            if (o2.getRevision() == null) {
-                return -1;
-            }
 
-            return o2.getRevision().compareTo(o1.getRevision());
-        }
+        return o2.getRevision().compareTo(o1.getRevision());
     };
 
+    protected static final Supplier<TreeSet<Module>> MODULE_SET_SUPPLIER = () -> new TreeSet<>(REVISION_COMPARATOR);
+
     /**
      * @return yang sources where key is ModuleIdentifier
      */