Use Map.entry() 73/105073/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Mar 2023 07:42:55 +0000 (09:42 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Mar 2023 08:23:08 +0000 (10:23 +0200)
We guarantee non-null values, use a well-known Map.entry() method
instead of SimpleImmutableEntry.

Change-Id: I026080a01f8cb39d12fc912cca0be1ecfdb775b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
plugins/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/LibraryModulesSchemas.java

index 23ab5582325907fcea7a0ee5198e23ae0c323ffe..9ad1bea079bc915177c32ae4d0728323e0d72b5c 100644 (file)
@@ -27,7 +27,6 @@ import java.net.URL;
 import java.net.URLConnection;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
-import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Base64;
 import java.util.Collection;
 import java.util.HashMap;
@@ -354,7 +353,7 @@ public final class LibraryModulesSchemas implements NetconfDeviceSchemas {
                 : QName.create(XMLNamespace.of(moduleNameSpace), moduleName);
 
         try {
-            return new SimpleImmutableEntry<>(moduleQName, new URL(schemaUriAsString.orElseThrow()));
+            return Map.entry(moduleQName, new URL(schemaUriAsString.orElseThrow()));
         } catch (final MalformedURLException e) {
             LOG.warn("Skipping library schema for {}. URL {} representing yang schema resource is not valid",
                     moduleNode, schemaUriAsString.orElseThrow());