Here you can find the source of flattenNodeIds( Collection
public static Set<Long> flattenNodeIds( Collection<Set<Long>> nodesInMotif)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static Set<Long> flattenNodeIds( Collection<Set<Long>> nodesInMotif) { Set<Long> nodes = new HashSet<Long>(); synchronized (nodesInMotif) { try { for (Set<Long> motifNodes : nodesInMotif) { nodes.addAll(motifNodes); }/* ww w . ja v a2 s . c om*/ } catch (ConcurrentModificationException cme) { System.err.println("Error occurred " + cme.getMessage()); // don't do anything } } return nodes; } }