Use java.util.function.Predicate 89/106389/1
authorIvan Hrasko <ivan.hrasko@pantheon.tech>
Tue, 6 Jun 2023 08:41:02 +0000 (10:41 +0200)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Tue, 6 Jun 2023 08:56:01 +0000 (10:56 +0200)
Use java.util.function.Predicate instead of Guava's Predicate
in YangLibProvider.java.

Change-Id: I25144169355c3d3160ea04c0d4de4fa68c89e962
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java

index 77b171af536156761ab1d03e7cee64dd981cdd79..c5fc37679f9124f7cf3367b00ccc046eb79b8999 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.yanglib.impl;
 import static com.google.common.base.Preconditions.checkArgument;
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.base.Predicate;
 import com.google.common.base.Strings;
 import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.FutureCallback;
@@ -22,6 +21,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
+import java.util.function.Predicate;
 import javax.ws.rs.NotFoundException;
 import javax.ws.rs.WebApplicationException;
 import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -116,7 +116,7 @@ public class YangLibProvider implements AutoCloseable, SchemaSourceListener, Yan
     public void schemaSourceRegistered(final Iterable<PotentialSchemaSource<?>> sources) {
         final Map<ModuleKey, Module> newModules = new HashMap<>();
 
-        for (PotentialSchemaSource<?> potentialYangSource : Iterables.filter(sources, YANG_SCHEMA_SOURCE)) {
+        for (PotentialSchemaSource<?> potentialYangSource : Iterables.filter(sources, YANG_SCHEMA_SOURCE::test)) {
             final YangIdentifier moduleName =
                 new YangIdentifier(potentialYangSource.getSourceIdentifier().name().getLocalName());
 
@@ -154,7 +154,7 @@ public class YangLibProvider implements AutoCloseable, SchemaSourceListener, Yan
 
     @Override
     public void schemaSourceUnregistered(final PotentialSchemaSource<?> source) {
-        if (!YANG_SCHEMA_SOURCE.apply(source)) {
+        if (!YANG_SCHEMA_SOURCE.test(source)) {
             // if representation of potential schema source is not yang text schema source do nothing
             // we do not want to delete this module entry from module list
             return;