HashSet<ClusterCombo> getViableClusterCombos(TreeMap<Integer, NodeCluster> nodeClusters) { HashSet<ClusterCombo> clusterCheck = new HashSet<>(); for (NodeCluster c1 : nodeClusters.values()) { for (NodeCluster c2 : c1.getOutBoundClusters()) { outBoundClusterSize++; // skip if this combination is already i the hashset clusterCheck.add(new ClusterCombo(c1.getId(), c2.getId())); } } // System.out.println("Clustercombos: " + clusterCheck.size()); return clusterCheck; }