Cleanup root pom "name".
[controller.git] / opendaylight / netconf / netconf-impl / src / main / java / org / opendaylight / controller / netconf / impl / osgi / NetconfOperationServiceSnapshotImpl.java
index ce312548b2858f7884596ea1f8d2b9f927f966a5..26abdd974ddc7a6d9bfdd42c85147e39fde5e7b6 100644 (file)
@@ -8,31 +8,28 @@
 
 package org.opendaylight.controller.netconf.impl.osgi;
 
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+import java.util.Set;
 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService;
 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory;
 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceSnapshot;
 import org.opendaylight.controller.netconf.util.CloseableUtil;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
 public class NetconfOperationServiceSnapshotImpl implements NetconfOperationServiceSnapshot {
 
     private final Set<NetconfOperationService> services;
     private final String netconfSessionIdForReporting;
 
-    public NetconfOperationServiceSnapshotImpl(Set<NetconfOperationServiceFactory> factories, String sessionIdForReporting) {
-        Set<NetconfOperationService> services = new HashSet<>();
+    public NetconfOperationServiceSnapshotImpl(final Set<NetconfOperationServiceFactory> factories, final String sessionIdForReporting) {
+        final Builder<NetconfOperationService> b = ImmutableSet.builder();
         netconfSessionIdForReporting = sessionIdForReporting;
         for (NetconfOperationServiceFactory factory : factories) {
-            services.add(factory.createService(netconfSessionIdForReporting));
+            b.add(factory.createService(netconfSessionIdForReporting));
         }
-        this.services = Collections.unmodifiableSet(services);
+        this.services = b.build();
     }
 
-
-
     @Override
     public String getNetconfSessionIdForReporting() {
         return netconfSessionIdForReporting;