public static Map<UUID,Collection<ClusterNode>> neighbors(Collection<ClusterNode> topSnapshot){
  Map<String,Collection<ClusterNode>> macMap=new HashMap<>(topSnapshot.size(),1.0f);
  for (  ClusterNode node : topSnapshot) {
    String macs=node.attribute(IgniteNodeAttributes.ATTR_MACS);
    Collection<ClusterNode> nodes=macMap.get(macs);
    if (nodes == null)     macMap.put(macs,nodes=new HashSet<>());
    nodes.add(node);
  }
  Map<UUID,Collection<ClusterNode>> neighbors=new HashMap<>(topSnapshot.size(),1.0f);
  for (  Collection<ClusterNode> group : macMap.values())   for (  ClusterNode node : group)   neighbors.put(node.id(),group);
  return neighbors;
}

public static Map < UUID , Collection < ClusterNode > > neighbors ( Collection < ClusterNode > topSnapshot ) { Map < String , Collection < ClusterNode > > macMap = new HashMap < > ( topSnapshot . size ( ) , 1.0f ) ; for ( ClusterNode node : topSnapshot ) { String macs = node . attribute ( IgniteNodeAttributes . ATTR_MACS ) ; Collection < ClusterNode > nodes = macMap . get ( macs ) ; if ( nodes == null ) macMap . put ( macs , nodes = new HashSet < > ( ) ) ; nodes . add ( node ) ; } Map < UUID , Collection < ClusterNode > > neighbors = new HashMap < > ( topSnapshot . size ( ) , 1.0f ) ; for ( Collection < ClusterNode > group : macMap . values ( ) ) for ( ClusterNode node : group ) neighbors . put ( node . id ( ) , group ) ; return neighbors ; }
builds neighborhood map for all nodes in snapshot .
