/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * 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.controller.netconf.impl.osgi;

import java.util.Collections;
import java.util.HashSet;
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;

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<>();
        netconfSessionIdForReporting = sessionIdForReporting;
        for (NetconfOperationServiceFactory factory : factories) {
            services.add(factory.createService(netconfSessionIdForReporting));
        }
        this.services = Collections.unmodifiableSet(services);
    }



    @Override
    public String getNetconfSessionIdForReporting() {
        return netconfSessionIdForReporting;
    }

    @Override
    public Set<NetconfOperationService> getServices() {
        return services;
    }

    @Override
    public void close() throws Exception {
        CloseableUtil.closeAll(services);
    }

    @Override
    public String toString() {
        return "NetconfOperationServiceSnapshotImpl{" + netconfSessionIdForReporting + '}';
    }
}

@@ -369,55 +369,101 @@
 ort 
-java.util.Collections;%0Aimport java.util.HashSet
+com.google.common.collect.ImmutableSet;%0Aimport com.google.common.collect.ImmutableSet.Builder
 ;%0Aim
@@ -1056,16 +1056,22 @@
 hotImpl(
+final 
 Set%3CNetc
@@ -1108,16 +1108,22 @@
 ctories,
+ final
  String 
@@ -1155,19 +1155,29 @@
         
-Set
+final Builder
 %3CNetconf
@@ -1198,32 +1198,32 @@
 ce%3E 
-services = new HashSet%3C%3E
+b = ImmutableSet.builder
 ();%0A
@@ -1363,24 +1363,17 @@
         
-services
+b
 .add(fac
@@ -1461,44 +1461,16 @@
 s = 
-Collections.unmodifiableSet(services
+b.build(
 );%0A 
@@ -1475,18 +1475,16 @@
 %0A    %7D%0A%0A
-%0A%0A
     @Ove

use ImmutableSet instead of an unmodifieable HashSet