public static void splitClusters(final ClusterSet clusterSet, final ClusterSetInfo clusterSetInfo,
                    List<Cluster> clusters, ExecutorService executorService) {
        final Random random = new Random();
        List<Runnable> tasks = new ArrayList<>();
        for (final Cluster cluster : clusters) {
            tasks.add(new Runnable() {
                public void run() {
                    try {
                        Point point = cluster.getPoints().remove(random.nextInt(cluster.getPoints().size()));
                        clusterSet.addNewClusterWithCenter(point);
                    } catch (Throwable t) {
                        log.warn("Error Splitting clusters (2)", t);
                    }
                }
            });
        }

        MultiThreadUtils.parallelTasks(tasks, executorService);
    }
public static void splitClusters ( final ClusterSet clusterSet , final ClusterSetInfo clusterSetInfo , List < Cluster > clusters , ExecutorService executorService ) { final Random random = new Random ( ) ; List < Runnable > tasks = new ArrayList < > ( ) ; for ( final Cluster cluster : clusters ) { tasks . add ( new Runnable ( ) { public void run ( ) { try { Point point = cluster . getPoints ( ) . remove ( random . nextInt ( cluster . getPoints ( ) . size ( ) ) ) ; clusterSet . addNewClusterWithCenter ( point ) ; } catch ( Throwable t ) { log . warn ( "Error Splitting clusters (2)" , t ) ; } } } ) ; } MultiThreadUtils . parallelTasks ( tasks , executorService ) ; }
@param clusterSet
@param clusterSetInfo
@param clusters
@param executorService