Modernize collection allocation 20/79220/3
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 4 Jan 2019 03:37:18 +0000 (04:37 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 4 Jan 2019 11:09:56 +0000 (12:09 +0100)
Eliminate Maps.newHashMap(), Lists.newArrayList(), Sets.newHashSet()
and related calls in favor of explicit instantiation.

Also eliminate use of deprecated ConcurrentSet.

Change-Id: Ie9b961b9db0984480374be53795c308882d3cdaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
32 files changed:
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/CurrentSchemaContext.java
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSource.java
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NotificationTopicRegistration.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/xml/XmlElement.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/AggregatedNetconfOperationServiceFactory.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfCapabilityMonitoringService.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfOperationRouterImpl.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfSessionMonitoringService.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/util/DeserializerExceptionHandler.java
netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/GetSchema.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfXMLToHelloMessageDecoder.java
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/NetconfChunkAggregatorTest.java
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/NetconfXMLToHelloMessageDecoderTest.java
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/NetconfXMLToMessageDecoderTest.java
netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/NetconfNotificationManager.java
netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/ProxyYangTextSourceProvider.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/NetconfNodeActorTest.java
netconf/netconf-topology/src/test/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImplTest.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfDeviceCommunicator.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceSalFacade.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractWriteTx.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/NetconfMessageTransformerTest.java
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/streams/listeners/AbstractCommonSubscriber.java
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonBasicDataTypesTest.java
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/AbstractCommonSubscriber.java
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/ParameterAwareNormalizedNodeWriterFieldsTest.java
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierSerializerTest.java

index 2c5adb41b3a31b8f0f0819497b897da6d77e70b4..66f053e9f71316f80debacbeaeb828877b0355c1 100644 (file)
@@ -5,12 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.mdsal.connector;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
@@ -25,7 +24,7 @@ import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
 public class CurrentSchemaContext implements SchemaContextListener, AutoCloseable {
     private final AtomicReference<SchemaContext> currentContext = new AtomicReference<>();
     private final ListenerRegistration<SchemaContextListener> schemaContextListenerListenerRegistration;
-    private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(Sets.newHashSet());
+    private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(new HashSet<>());
     private final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider;
 
     public SchemaContext getCurrentContext() {
index 0d84d9a89a51252612b939f987f15c5b7c05bf2f..849c0de8d86af4f08e9042f7d5739825639d1e82 100644 (file)
@@ -220,8 +220,7 @@ public class NetconfEventSource implements EventSource, DOMNotificationListener
         final String namespace = notification.getType().getLastComponent().getNamespace().toString();
         for (NotificationTopicRegistration notifReg : notificationTopicRegistrations.get(namespace)) {
             notifReg.setLastEventTime(notificationEventTime);
-            Set<TopicId> topicIdsForNotification = notifReg.getTopicsForNotification(notificationPath);
-            for (TopicId topicId : topicIdsForNotification) {
+            for (TopicId topicId : notifReg.getTopicsForNotification(notificationPath)) {
                 publishNotification(notification, topicId);
                 LOG.debug("Notification {} has been published for TopicId {}", notification.getType(),
                         topicId.getValue());
index efd0c0b12c8259351b7ea26571e9b177d08666b7..b3499a1ecbc34eaf08b8116c5f62e47a6a6eaa3c 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.netconf.messagebus.eventsources.netconf;
 
-import com.google.common.collect.Sets;
 import java.time.Instant;
+import java.util.HashSet;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -74,7 +74,7 @@ abstract class NotificationTopicRegistration implements AutoCloseable {
      */
     Set<TopicId> getTopicsForNotification(final SchemaPath notificationPath) {
         final Set<TopicId> topicIds = notificationTopicMap.get(notificationPath);
-        return topicIds != null ? topicIds : Sets.newHashSet();
+        return topicIds != null ? topicIds : new HashSet<>();
     }
 
     /**
index 9b0f5e3af7293d03fe752197e112be0a3155bfab..c04fda11ac240f862a82c09cb43e2de3e552a69e 100644 (file)
@@ -5,15 +5,14 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.api.xml;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 import java.io.IOException;
+import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -170,7 +169,7 @@ public final class XmlElement {
 
     public Map<String, Attr> getAttributes() {
 
-        Map<String, Attr> mappedAttributes = Maps.newHashMap();
+        Map<String, Attr> mappedAttributes = new HashMap<>();
 
         NamedNodeMap attributes = element.getAttributes();
         for (int i = 0; i < attributes.getLength(); i++) {
@@ -446,7 +445,7 @@ public final class XmlElement {
             throw new IllegalArgumentException("Cannot find namespace for " + XmlUtil.toString(element)
                 + ". Prefix from content is " + prefix + ". Found namespaces " + namespaces);
         }
-        return Maps.immutableEntry(prefix, namespaces.get(prefix));
+        return new SimpleImmutableEntry<>(prefix, namespaces.get(prefix));
     }
 
     public List<XmlElement> getChildElementsWithSameNamespace(final String childName) throws MissingNameSpaceException {
index cd3aa6104e24ca777e83517b8e6f58075b4ec2e7..da3c4231f38c9a3a8171b056ed6eb5992c347d30 100644 (file)
@@ -5,21 +5,19 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.impl.osgi;
 
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSet.Builder;
-import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multimaps;
-import com.google.common.collect.Sets;
-import io.netty.util.internal.ConcurrentSet;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import org.opendaylight.netconf.api.capability.Capability;
 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
 import org.opendaylight.netconf.mapping.api.NetconfOperation;
@@ -38,10 +36,10 @@ public class AggregatedNetconfOperationServiceFactory
 
     private static final Logger LOG = LoggerFactory.getLogger(AggregatedNetconfOperationServiceFactory.class);
 
-    private final Set<NetconfOperationServiceFactory> factories = new ConcurrentSet<>();
+    private final Set<NetconfOperationServiceFactory> factories = ConcurrentHashMap.newKeySet();
     private final Multimap<NetconfOperationServiceFactory, AutoCloseable> registrations =
             Multimaps.synchronizedMultimap(HashMultimap.create());
-    private final Set<CapabilityListener> listeners = new ConcurrentSet<>();
+    private final Set<CapabilityListener> listeners = ConcurrentHashMap.newKeySet();
 
     public AggregatedNetconfOperationServiceFactory() {
     }
@@ -78,7 +76,7 @@ public class AggregatedNetconfOperationServiceFactory
 
     @Override
     public Set<Capability> getCapabilities() {
-        final HashSet<Capability> capabilities = Sets.newHashSet();
+        final Set<Capability> capabilities = new HashSet<>();
         for (final NetconfOperationServiceFactory factory : factories) {
             capabilities.addAll(factory.getCapabilities());
         }
@@ -87,7 +85,7 @@ public class AggregatedNetconfOperationServiceFactory
 
     @Override
     public synchronized AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
-        final Map<NetconfOperationServiceFactory, AutoCloseable> regs = Maps.newHashMap();
+        final Map<NetconfOperationServiceFactory, AutoCloseable> regs = new HashMap<>();
 
         for (final NetconfOperationServiceFactory factory : factories) {
             final AutoCloseable reg = factory.registerCapabilityListener(listener);
@@ -136,7 +134,7 @@ public class AggregatedNetconfOperationServiceFactory
 
         @Override
         public Set<NetconfOperation> getNetconfOperations() {
-            final HashSet<NetconfOperation> operations = Sets.newHashSet();
+            final Set<NetconfOperation> operations = new HashSet<>();
             for (final NetconfOperationService service : services) {
                 operations.addAll(service.getNetconfOperations());
             }
index 0cc50d884799f17a721fc726d1c8a88124c8542e..5e039cf67ffc29003e62777965e8e430f2c2ddd4 100644 (file)
@@ -18,10 +18,10 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableList.Builder;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -57,11 +57,11 @@ class NetconfCapabilityMonitoringService implements CapabilityListener, AutoClos
     private static final Function<Capability, Uri> CAPABILITY_TO_URI = input -> new Uri(input.getCapabilityUri());
 
     private final NetconfOperationServiceFactory netconfOperationProvider;
-    private final Map<Uri, Capability> capabilities = Maps.newHashMap();
-    private final Map<String, Map<String, String>> mappedModulesToRevisionToSchema = Maps.newHashMap();
+    private final Map<Uri, Capability> capabilities = new HashMap<>();
+    private final Map<String, Map<String, String>> mappedModulesToRevisionToSchema = new HashMap<>();
 
 
-    private final Set<NetconfMonitoringService.CapabilitiesListener> listeners = Sets.newHashSet();
+    private final Set<NetconfMonitoringService.CapabilitiesListener> listeners = new HashSet<>();
     private volatile BaseNotificationPublisherRegistration notificationPublisher;
 
     NetconfCapabilityMonitoringService(final NetconfOperationServiceFactory netconfOperationProvider) {
@@ -112,7 +112,7 @@ class NetconfCapabilityMonitoringService implements CapabilityListener, AutoClos
 
             final String currentModuleName = cap.getModuleName().get();
             Map<String, String> revisionMap =
-                mappedModulesToRevisionToSchema.computeIfAbsent(currentModuleName, k -> Maps.newHashMap());
+                mappedModulesToRevisionToSchema.computeIfAbsent(currentModuleName, k -> new HashMap<>());
 
             final String currentRevision = cap.getRevision().get();
             revisionMap.put(currentRevision, cap.getCapabilitySchema().get());
index 65a96e7583a8b1d19ecd4231a21788c5745b7a32..6eda367bd53180fcae166df813ff13813358aac3 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.netconf.impl.osgi;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -130,7 +129,7 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter {
 
     private TreeMap<HandlingPriority, NetconfOperation> getSortedNetconfOperationsWithCanHandle(
             final Document message, final NetconfServerSession session) throws DocumentedException {
-        final TreeMap<HandlingPriority, NetconfOperation> sortedPriority = Maps.newTreeMap();
+        final TreeMap<HandlingPriority, NetconfOperation> sortedPriority = new TreeMap<>();
 
         for (final NetconfOperation netconfOperation : allNetconfOperations) {
             final HandlingPriority handlingPriority = netconfOperation.canHandle(message);
index 639daa803d35a2627f18acb120133e868484d01a..103dc1bcf84caf9fb7306e98fd0042d093871a5d 100644 (file)
@@ -11,8 +11,8 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Sets;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
@@ -39,9 +39,9 @@ class NetconfSessionMonitoringService implements SessionListener, AutoCloseable
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfSessionMonitoringService.class);
 
-    private final Set<NetconfManagementSession> sessions = Sets.newHashSet();
-    private final Set<NetconfManagementSession> changedSessions = Sets.newHashSet();
-    private final Set<NetconfMonitoringService.SessionsListener> listeners = Sets.newHashSet();
+    private final Set<NetconfManagementSession> sessions = new HashSet<>();
+    private final Set<NetconfManagementSession> changedSessions = new HashSet<>();
+    private final Set<NetconfMonitoringService.SessionsListener> listeners = new HashSet<>();
     private final ScheduledExecutorService executor;
     private final long updateInterval;
     private boolean running;
index effccf3701113cae251ba4563f29d00a5f5b86c8..4973d255a94038be9f79cc75b1168c0d10fad6dc 100644 (file)
@@ -5,12 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.impl.util;
 
-import com.google.common.collect.Maps;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
+import java.util.HashMap;
 import java.util.Map;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.util.messages.SendErrorExceptionUtil;
@@ -38,8 +37,7 @@ public final class DeserializerExceptionHandler implements ChannelHandler {
     }
 
     private static void handleDeserializerException(final ChannelHandlerContext ctx, final Throwable cause) {
-
-        final Map<String, String> info = Maps.newHashMap();
+        final Map<String, String> info = new HashMap<>();
         info.put("cause", cause.getMessage());
         final DocumentedException ex = new DocumentedException(cause.getMessage(),
                 DocumentedException.ErrorType.RPC, DocumentedException.ErrorTag.MALFORMED_MESSAGE,
index bc42da5b0870b5e9493f40c36b4a3c8578e796a1..4f8374c974c300868afababbd8a1393802e224c5 100644 (file)
@@ -5,11 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.monitoring;
 
 import com.google.common.base.Optional;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
 import java.util.Map;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
@@ -56,7 +55,7 @@ public class GetSchema extends AbstractSingletonNetconfOperation {
         try {
             schema = cap.getSchemaForCapability(entry.identifier, entry.version);
         } catch (final IllegalStateException e) {
-            final Map<String, String> errorInfo = Maps.newHashMap();
+            final Map<String, String> errorInfo = new HashMap<>();
             errorInfo.put(DocumentedException.ErrorTag.OPERATION_FAILED.toString(), e.getMessage());
             LOG.warn("Rpc error: {}", DocumentedException.ErrorTag.OPERATION_FAILED, e);
             throw new DocumentedException(e.getMessage(), e, DocumentedException.ErrorType.APPLICATION,
index 6e02a3fa97cca9e3a5eab0df66750cfb2ce63b4f..31a3284debfe46222773f08a3facda07dbd9c7c2 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.netconf.nettyutil.handler;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufUtil;
 import io.netty.channel.ChannelHandlerContext;
@@ -19,6 +18,7 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import org.opendaylight.netconf.api.NetconfMessage;
@@ -53,7 +53,7 @@ public final class NetconfXMLToHelloMessageDecoder extends ByteToMessageDecoder
     // State variables do not have to by synchronized
     // Netty uses always the same (1) thread per pipeline
     // We use instance of this per pipeline
-    private final List<NetconfMessage> nonHelloMessages = Lists.newArrayList();
+    private final List<NetconfMessage> nonHelloMessages = new ArrayList<>();
     private boolean helloReceived = false;
 
     @Override
index a9a67f19c43e0474006b1b92e6ee328fea10b352..5d692b2fcf35274c2c2899ecc9db7268dc3621e0 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.netconf.nettyutil.handler;
 
 import static org.junit.Assert.assertEquals;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
 import java.util.List;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -45,7 +45,7 @@ public class NetconfChunkAggregatorTest {
 
     @Test
     public void testMultipleChunks() throws Exception {
-        final List<Object> output = Lists.newArrayList();
+        final List<Object> output = new ArrayList<>();
         final ByteBuf input = Unpooled.copiedBuffer(CHUNKED_MESSAGE.getBytes(StandardCharsets.UTF_8));
         agr.decode(null, input, output);
 
@@ -57,7 +57,7 @@ public class NetconfChunkAggregatorTest {
 
     @Test
     public void testOneChunks() throws Exception {
-        final List<Object> output = Lists.newArrayList();
+        final List<Object> output = new ArrayList<>();
         final ByteBuf input = Unpooled.copiedBuffer(CHUNKED_MESSAGE_ONE.getBytes(StandardCharsets.UTF_8));
         agr.decode(null, input, output);
 
@@ -66,6 +66,4 @@ public class NetconfChunkAggregatorTest {
 
         assertEquals(EXPECTED_MESSAGE, chunk.toString(StandardCharsets.UTF_8));
     }
-
-
 }
index 1581377f90a9e3020abd8f4d03445258b5de5c49..1244991e32f89e15b4b5f9a4ed7cb4e1412ce216 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.nettyutil.handler;
 
 import static org.junit.Assert.assertEquals;
@@ -14,9 +13,9 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
 import java.util.List;
 import org.hamcrest.CoreMatchers;
 import org.junit.Test;
@@ -30,7 +29,7 @@ public class NetconfXMLToHelloMessageDecoderTest {
         final ByteBuf src = Unpooled.wrappedBuffer(String.format("%s\n%s",
                 "[tomas;10.0.0.0:10000;tcp;client;]",
                 "<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>").getBytes());
-        final List<Object> out = Lists.newArrayList();
+        final List<Object> out = new ArrayList<>();
         new NetconfXMLToHelloMessageDecoder().decode(null, src, out);
 
         assertEquals(1, out.size());
@@ -47,7 +46,7 @@ public class NetconfXMLToHelloMessageDecoderTest {
     public void testDecodeNoHeader() throws Exception {
         final ByteBuf src =
                 Unpooled.wrappedBuffer("<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>".getBytes());
-        final List<Object> out = Lists.newArrayList();
+        final List<Object> out = new ArrayList<>();
         new NetconfXMLToHelloMessageDecoder().decode(null, src, out);
 
         assertEquals(1, out.size());
@@ -64,7 +63,7 @@ public class NetconfXMLToHelloMessageDecoderTest {
                 Unpooled.wrappedBuffer("<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>".getBytes());
         final ByteBuf src =
                 Unpooled.wrappedBuffer("<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>".getBytes());
-        final List<Object> out = Lists.newArrayList();
+        final List<Object> out = new ArrayList<>();
         final NetconfXMLToHelloMessageDecoder decoder = new NetconfXMLToHelloMessageDecoder();
         decoder.decode(null, src, out);
         decoder.decode(null, msg1, out);
@@ -79,7 +78,7 @@ public class NetconfXMLToHelloMessageDecoderTest {
     public void testDecodeNotHelloReceived() throws Exception {
         final ByteBuf msg1 =
                 Unpooled.wrappedBuffer("<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>".getBytes());
-        final List<Object> out = Lists.newArrayList();
+        final List<Object> out = new ArrayList<>();
         NetconfXMLToHelloMessageDecoder decoder = new NetconfXMLToHelloMessageDecoder();
         decoder.decode(null, msg1, out);
     }
index 8600253f36c0ff39506fb5b4c6e7434195577f43..e9a7d9cc5e470c4044a5137852e80930230869e0 100644 (file)
@@ -5,13 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.nettyutil.handler;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
 import org.junit.Test;
@@ -22,14 +20,14 @@ public class NetconfXMLToMessageDecoderTest {
 
     @Test
     public void testDecodeNoMoreContent() throws Exception {
-        final ArrayList<Object> out = Lists.newArrayList();
+        final ArrayList<Object> out = new ArrayList<>();
         new NetconfXMLToMessageDecoder().decode(null, Unpooled.buffer(), out);
         assertEquals(0, out.size());
     }
 
     @Test
     public void testDecode() throws Exception {
-        final ArrayList<Object> out = Lists.newArrayList();
+        final ArrayList<Object> out = new ArrayList<>();
         new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("<msg/>".getBytes()), out);
         assertEquals(1, out.size());
     }
@@ -40,7 +38,7 @@ public class NetconfXMLToMessageDecoderTest {
          * XML declaration in the XML prologue.
          * A leading LF is the case reported in BUG-2838.
          */
-        final ArrayList<Object> out = Lists.newArrayList();
+        final ArrayList<Object> out = new ArrayList<>();
         new NetconfXMLToMessageDecoder().decode(null,
                 Unpooled.wrappedBuffer("\n<?xml version=\"1.0\" encoding=\"UTF-8\"?><msg/>".getBytes()), out);
         assertEquals(1, out.size());
@@ -53,7 +51,7 @@ public class NetconfXMLToMessageDecoderTest {
          * Leading CRLF can be seen with some Cisco routers
          * (eg CSR1000V running IOS 15.4(1)S)
          */
-        final ArrayList<Object> out = Lists.newArrayList();
+        final ArrayList<Object> out = new ArrayList<>();
         new NetconfXMLToMessageDecoder().decode(null,
                 Unpooled.wrappedBuffer("\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?><msg/>".getBytes()), out);
         assertEquals(1, out.size());
@@ -62,7 +60,7 @@ public class NetconfXMLToMessageDecoderTest {
     @Test
     public void testDecodeGibberish() throws Exception {
         /* Test that we reject inputs where we cannot find the xml start '<' character */
-        final ArrayList<Object> out = Lists.newArrayList();
+        final ArrayList<Object> out = new ArrayList<>();
         new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("\r\n?xml version>".getBytes()), out);
         assertEquals(1, out.size());
         assertTrue(FailedNetconfMessage.class.isInstance(out.get(0)));
@@ -74,7 +72,7 @@ public class NetconfXMLToMessageDecoderTest {
     public void testDecodeOnlyWhitespaces() throws Exception {
         /* Test that we handle properly a bunch of whitespaces.
          */
-        final ArrayList<Object> out = Lists.newArrayList();
+        final ArrayList<Object> out = new ArrayList<>();
         new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("\r\n".getBytes()), out);
         assertEquals(0, out.size());
     }
@@ -84,7 +82,7 @@ public class NetconfXMLToMessageDecoderTest {
         /* Test that every whitespace we want to skip is actually skipped.
          */
 
-        final ArrayList<Object> out = Lists.newArrayList();
+        final ArrayList<Object> out = new ArrayList<>();
         byte[] whitespaces = {' ', '\t', '\n', '\r', '\f', 0x0b /* vertical tab */};
         new NetconfXMLToMessageDecoder().decode(
                 null,
index ac29d547444c8f321be54deecb38de42c78678b5..01ab8411631b661100118054516ac76b9771f854 100644 (file)
@@ -5,17 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.notifications.impl;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.HashMultiset;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multiset;
-import com.google.common.collect.Sets;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import javax.annotation.concurrent.GuardedBy;
@@ -71,16 +70,16 @@ public class NetconfNotificationManager implements NetconfNotificationCollector,
             HashMultimap.create();
 
     @GuardedBy("this")
-    private final Set<NetconfNotificationStreamListener> streamListeners = Sets.newHashSet();
+    private final Set<NetconfNotificationStreamListener> streamListeners = new HashSet<>();
 
     @GuardedBy("this")
-    private final Map<StreamNameType, Stream> streamMetadata = Maps.newHashMap();
+    private final Map<StreamNameType, Stream> streamMetadata = new HashMap<>();
 
     @GuardedBy("this")
     private final Multiset<StreamNameType> availableStreams = HashMultiset.create();
 
     @GuardedBy("this")
-    private final Set<GenericNotificationPublisherReg> notificationPublishers = Sets.newHashSet();
+    private final Set<GenericNotificationPublisherReg> notificationPublishers = new HashSet<>();
 
     @Override
     public synchronized void onNotification(final StreamNameType stream, final NetconfNotification notification) {
index 3e0983812e7e0093c95184bf23bbece2ac6ee0cf..99435ea15a7244a7f2499ce1f6e73a8067f69ae9 100644 (file)
@@ -5,12 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.notifications.impl.ops;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import org.opendaylight.netconf.api.DocumentedException;
@@ -46,7 +45,7 @@ public class CreateSubscription extends AbstractSingletonNetconfOperation
     static final String CREATE_SUBSCRIPTION = "create-subscription";
 
     private final NetconfNotificationRegistry notifications;
-    private final List<NotificationListenerRegistration> subscriptions = Lists.newArrayList();
+    private final List<NotificationListenerRegistration> subscriptions = new ArrayList<>();
     private NetconfSession netconfSession;
 
     public CreateSubscription(final String netconfSessionIdForReporting,
index 29423dddb18e6322c5795b122b4b3bae2c5a71d0..aa3bd3872f36cdac98d4a5de1f27f6f142167c07 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.topology.singleton.impl;
 
 import akka.actor.ActorRef;
@@ -13,7 +12,7 @@ import akka.dispatch.Futures;
 import akka.dispatch.OnComplete;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
-import com.google.common.collect.Sets;
+import java.util.Collections;
 import java.util.Set;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.schema.provider.RemoteYangTextSourceProvider;
@@ -40,7 +39,7 @@ public class ProxyYangTextSourceProvider implements RemoteYangTextSourceProvider
     @Override
     public Future<Set<SourceIdentifier>> getProvidedSources() {
         // NOOP
-        return Futures.successful(Sets.newHashSet());
+        return Futures.successful(Collections.emptySet());
     }
 
     @Override
index 6219a6eb67299e186f62e565ff5670dead222d1e..4f79e46c1a9468a8ae5d2f9c7eda8cc09a8640f7 100644 (file)
@@ -44,6 +44,7 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.SettableFuture;
 import java.io.InputStream;
 import java.net.InetSocketAddress;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Scanner;
@@ -197,7 +198,7 @@ public class NetconfNodeActorTest {
 
         // Test CreateInitialMasterActorData.
 
-        initializeMaster(Lists.newArrayList());
+        initializeMaster(new ArrayList<>());
 
         // Test RefreshSetupMasterActorData.
 
index 343c70eb8074edf9362cca4cdaf61c36b8d16998..813b4276bba854b9c5f35a8b919ab8f5aff5f05a 100644 (file)
@@ -17,7 +17,6 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.opendaylight.mdsal.common.api.CommitInfo.emptyFluentFuture;
 
-import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -26,6 +25,7 @@ import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.ImmediateEventExecutor;
 import io.netty.util.concurrent.SucceededFuture;
 import java.util.Collection;
+import java.util.HashSet;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -175,7 +175,7 @@ public class NetconfTopologyImplTest {
         when(newNode.getDataAfter()).thenReturn(nn.build());
 
 
-        final Collection<DataTreeModification<Node>> changes = Sets.newHashSet();
+        final Collection<DataTreeModification<Node>> changes = new HashSet<>();
         final DataTreeModification<Node> ch = mock(DataTreeModification.class);
         when(ch.getRootNode()).thenReturn(newNode);
         changes.add(ch);
index 7373b819cbcba5051f9b6313d76cf79f88f9b309..dfdf18b2650e8b7de1afe35ba96f6d1e6502d1b6 100644 (file)
@@ -9,12 +9,12 @@ package org.opendaylight.netconf.sal.connect.netconf.listener;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import io.netty.util.concurrent.Future;
 import java.util.ArrayDeque;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Queue;
@@ -180,7 +180,7 @@ public class NetconfDeviceCommunicator
             LOG.warn("It's curious that no one to close the session but tearDown is called!");
         }
         LOG.debug("Tearing down {}", reason);
-        final List<UncancellableFuture<RpcResult<NetconfMessage>>> futuresToCancel = Lists.newArrayList();
+        final List<UncancellableFuture<RpcResult<NetconfMessage>>> futuresToCancel = new ArrayList<>();
         sessionLock.lock();
         try {
             if (currentSession != null) {
index 4f050d6140e64c1440b2d457ae6938ece16fb667..74378ce938a5d341cadce34b39f617c8dd9e27c6 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.netconf.sal.connect.netconf.sal;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Lists;
+import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.dom.api.DOMActionService;
@@ -30,7 +31,7 @@ public final class NetconfDeviceSalFacade implements AutoCloseable, RemoteDevice
 
     private final RemoteDeviceId id;
     private final NetconfDeviceSalProvider salProvider;
-    private final List<AutoCloseable> salRegistrations = Lists.newArrayList();
+    private final List<AutoCloseable> salRegistrations = new ArrayList<>();
 
     public NetconfDeviceSalFacade(final RemoteDeviceId id, final DOMMountPointService mountPointService,
             final DataBroker dataBroker) {
index 1d1c125ff728b8aa30b289153eaa4025c83c4d3d..fa94ad0b45bbbdc30809b08f0ffe4101f00bbdfb 100644 (file)
@@ -5,17 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.sal.connect.netconf.sal.tx;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
@@ -49,7 +48,7 @@ public abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
     protected final RemoteDeviceId id;
     protected final NetconfBaseOps netOps;
     protected final boolean rollbackSupport;
-    protected final List<ListenableFuture<DOMRpcResult>> resultsFutures;
+    protected final List<ListenableFuture<DOMRpcResult>> resultsFutures = new ArrayList<>();
     private final List<TxListener> listeners = new CopyOnWriteArrayList<>();
     // Allow commit to be called only once
     protected volatile boolean finished = false;
@@ -58,7 +57,6 @@ public abstract class AbstractWriteTx implements DOMDataTreeWriteTransaction {
         this.netOps = netOps;
         this.id = id;
         this.rollbackSupport = rollbackSupport;
-        this.resultsFutures = Lists.newArrayList();
         init();
     }
 
index 140b0837b1a8ab946a888fa3beed5483ee5ef530..a91458077f24a0321b4742a8668039db7acca65f 100644 (file)
@@ -32,10 +32,10 @@ import static org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTr
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -213,7 +213,7 @@ public class NetconfMessageTransformerTest {
                 NetconfRemoteSchemaYangSourceProvider
                         .createGetSchemaRequest("module", Optional.of("2012-12-12")).getValue());
 
-        final Map<QName, Object> keys = Maps.newHashMap();
+        final Map<QName, Object> keys = new HashMap<>();
         for (final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> value : values) {
             keys.put(value.getNodeType(), value.getValue());
         }
@@ -293,7 +293,7 @@ public class NetconfMessageTransformerTest {
                 NetconfRemoteSchemaYangSourceProvider
                         .createGetSchemaRequest("module", Optional.of("2012-12-12")).getValue());
 
-        final Map<QName, Object> keys = Maps.newHashMap();
+        final Map<QName, Object> keys = new HashMap<>();
         for (final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> value : values) {
             keys.put(value.getNodeType(), value.getValue());
         }
index 2a7ba619c59a543fcedd6815912b458977396941..76827d4837aab083c672f44eb0879abc588191aa 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.netconf.sal.streams.listeners;
 import com.google.common.eventbus.AsyncEventBus;
 import com.google.common.eventbus.EventBus;
 import io.netty.channel.Channel;
-import io.netty.util.internal.ConcurrentSet;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Executors;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.slf4j.Logger;
@@ -24,7 +24,7 @@ abstract class AbstractCommonSubscriber extends AbstractQueryParams implements B
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractCommonSubscriber.class);
 
-    private final Set<Channel> subscribers = new ConcurrentSet<>();
+    private final Set<Channel> subscribers = ConcurrentHashMap.newKeySet();
     private final EventBus eventBus;
 
     @SuppressWarnings("rawtypes")
index d81d11e985d1bc301e1f196d4b8b2cf3719016f6..e2638733c1e3d4480a1a78c03fbc2150039bc32d 100644 (file)
@@ -13,12 +13,12 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
-import com.google.common.collect.Maps;
 import com.google.gson.stream.JsonReader;
 import com.google.gson.stream.JsonToken;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.StringReader;
+import java.util.HashMap;
 import java.util.Map;
 import org.junit.BeforeClass;
 import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
@@ -211,7 +211,7 @@ public class CnSnToJsonBasicDataTypesTest extends YangAndXmlAndDataSchemaLoader
     private static void jsonReadContElements(final JsonReader jsonReader) throws IOException {
         jsonReader.beginObject();
 
-        final Map<String, LeafVerifier> expectedMap = Maps.newHashMap();
+        final Map<String, LeafVerifier> expectedMap = new HashMap<>();
         expectedMap.put("lfnint8Min", new NumberVerifier(-128));
         expectedMap.put("lfnint8Max", new NumberVerifier(127));
         expectedMap.put("lfnint16Min", new NumberVerifier(-32768));
index 5bc14cb2a748b5149874f46c8fde50daeeb2f114..aa49c0bdc1588fb7cd2f3379a7f736879fa52cb4 100644 (file)
@@ -30,6 +30,7 @@ import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediate
 import com.google.common.collect.ImmutableClassToInstanceMap;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FluentFuture;
+import java.util.ArrayList;
 import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
@@ -366,7 +367,7 @@ public class BrokerFacadeTest {
         final PatchContext patchContext = mock(PatchContext.class);
         final InstanceIdentifierContext<?> identifierContext = mock(InstanceIdentifierContext.class);
 
-        when(patchContext.getData()).thenReturn(Lists.newArrayList());
+        when(patchContext.getData()).thenReturn(new ArrayList<>());
         doReturn(identifierContext).when(patchContext).getInstanceIdentifierContext();
 
         // no mount point
@@ -391,7 +392,7 @@ public class BrokerFacadeTest {
         final DOMDataBroker mountDataBroker = mock(DOMDataBroker.class);
         final DOMDataTreeReadWriteTransaction transaction = mock(DOMDataTreeReadWriteTransaction.class);
 
-        when(patchContext.getData()).thenReturn(Lists.newArrayList());
+        when(patchContext.getData()).thenReturn(new ArrayList<>());
         doReturn(identifierContext).when(patchContext).getInstanceIdentifierContext();
 
         // return mount point with broker
@@ -418,7 +419,7 @@ public class BrokerFacadeTest {
         final DOMDataBroker mountDataBroker = mock(DOMDataBroker.class);
         final DOMDataTreeReadWriteTransaction transaction = mock(DOMDataTreeReadWriteTransaction.class);
 
-        when(patchContext.getData()).thenReturn(Lists.newArrayList());
+        when(patchContext.getData()).thenReturn(new ArrayList<>());
         doReturn(identifierContext).when(patchContext).getInstanceIdentifierContext();
         when(identifierContext.getMountPoint()).thenReturn(mountPoint);
 
index 2d4aa4451b095047288de6df6eb6361b5add9f89..e595877373eb1da4cee00f996f4e4f2fd94c8594 100644 (file)
@@ -20,9 +20,9 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -714,7 +714,7 @@ public class RestGetOperationTest extends JerseyTest {
             return;
         }
 
-        final Map<String, NodeData> expChildMap = Maps.newHashMap();
+        final Map<String, NodeData> expChildMap = new HashMap<>();
         for (final NodeData expChild : (List<NodeData>) nodeData.data) {
             expChildMap.put(expChild.key.toString(), expChild);
         }
index 14085a14d96e02f85a4725ce18e125e8bf180bce..2ef40bec8977b358f1fd6ac8e7f12378e00d8e71 100644 (file)
@@ -19,7 +19,6 @@ import static org.mockito.Mockito.reset;
 import static org.mockito.Mockito.when;
 
 import com.google.common.collect.Iterators;
-import com.google.common.collect.Maps;
 import com.google.common.io.ByteStreams;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
@@ -30,6 +29,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -730,7 +730,7 @@ public class RestconfDocumentedExceptionMapperTest extends JerseyTest {
             final ErrorInfoVerifier errorInfoVerifier) {
 
         JsonElement errorInfoElement = null;
-        final Map<String, String> leafMap = Maps.newHashMap();
+        final Map<String, String> leafMap = new HashMap<>();
         for (final Entry<String, JsonElement> entry : errorEntryElement.getAsJsonObject().entrySet()) {
             final String leafName = entry.getKey();
             final JsonElement leafElement = entry.getValue();
index 3af3bca77ad90a35b6afbbf04f5fa8b058fabff7..a9b23db075028e4ff4d7af09c2ec280dc5383f88 100644 (file)
@@ -176,7 +176,7 @@ public class RestconfImplTest {
                 "2014-01-14", "create-notification-stream")).when(schemaNode).getQName();
         doReturn(null).when(iiCtx).getMountPoint();
 
-        final Set<DataContainerChild<?, ?>> children = Sets.newHashSet();
+        final Set<DataContainerChild<?, ?>> children = new HashSet<>();
         final DataContainerChild<?, ?> child = mock(DataContainerChild.class,
                 Mockito.withSettings().extraInterfaces(LeafSetNode.class));
 
index ebf5da4a0d5e24cccb7142a760e92c3e46c9cb10..06dec11304dfe3ed0a256143ced8250f6254b6cd 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.restconf.nb.rfc8040.streams.listeners;
 import com.google.common.eventbus.AsyncEventBus;
 import com.google.common.eventbus.EventBus;
 import io.netty.channel.Channel;
-import io.netty.util.internal.ConcurrentSet;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Executors;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.slf4j.Logger;
@@ -24,7 +24,7 @@ abstract class AbstractCommonSubscriber extends AbstractQueryParams implements B
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractCommonSubscriber.class);
 
-    private final Set<Channel> subscribers = new ConcurrentSet<>();
+    private final Set<Channel> subscribers = ConcurrentHashMap.newKeySet();
     private final EventBus eventBus;
 
     @SuppressWarnings("rawtypes")
index 37a5b897de6bc162975747e4d4bc1adb1dba5594..e3c4fa6863e3aaba6ededdfd0fa229792f610fa6 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.collect.Sets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Optional;
 import java.util.Set;
@@ -129,7 +130,7 @@ public class ParameterAwareNormalizedNodeWriterFieldsTest {
     @Test
     public void writeContainerWithLimitedFieldsTest() throws Exception {
         final List<Set<QName>> limitedFields = new ArrayList<>();
-        limitedFields.add(Sets.newHashSet());
+        limitedFields.add(new HashSet<>());
 
         final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter(
                 writer, null, limitedFields);
@@ -172,7 +173,7 @@ public class ParameterAwareNormalizedNodeWriterFieldsTest {
     @Test
     public void writeMapEntryNodeWithLimitedFieldsTest() throws Exception {
         final List<Set<QName>> limitedFields = new ArrayList<>();
-        limitedFields.add(Sets.newHashSet());
+        limitedFields.add(new HashSet<>());
 
         final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter(
                 writer, null, limitedFields);
index 35bb3dc1625b68fb87af883aaccab90197757e87..b508f2048e01b0ee26545ef744896319ecc17998 100644 (file)
@@ -11,8 +11,8 @@ package org.opendaylight.restconf.nb.rfc8040.utils.parser;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import org.junit.Before;
@@ -107,7 +107,7 @@ public class YangInstanceIdentifierSerializerTest {
     public void serializeListWithNoKeysTest() {
         final YangInstanceIdentifier data = YangInstanceIdentifier.builder()
                 .node(QName.create("serializer:test", "2016-06-06", "list-no-key"))
-                .nodeWithKey(QName.create("serializer:test", "2016-06-06", "list-no-key"), Maps.newHashMap())
+                .nodeWithKey(QName.create("serializer:test", "2016-06-06", "list-no-key"), new HashMap<>())
                 .build();
 
         final String result = YangInstanceIdentifierSerializer.create(this.schemaContext, data);