Java Collection Flatten flattenNodeIds( Collection> nodesInMotif)

Here you can find the source of flattenNodeIds( Collection> nodesInMotif)

Description

flatten Node Ids

License

Open Source License

Declaration

public static Set<Long> flattenNodeIds(
            Collection<Set<Long>> nodesInMotif) 

Method Source Code

//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;
    }
}

Related

  1. flatten(Collection original)
  2. flatten(final S targetCollection, final Collection> setOfSets)
  3. flattenCollection(Collection col)
  4. flattenCollection(Collection array, String fmt, char separator)
  5. flattenForest(Collection forest)
  6. flattenStrings(Collection values)
  7. flattenToString(Collection c)
  8. flattenToString(Collection collection, String delimiter)