Java List Join joinThreads(List threads)

Here you can find the source of joinThreads(List threads)

Description

join Threads

License

Open Source License

Declaration

public static boolean joinThreads(List<Thread> threads) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;
import java.util.Collection;

import java.util.List;

public class Main {
    public static boolean joinThreads(List<Thread> threads) {
        boolean interrupted = false;
        for (Thread curThread : threads) {
            try {
                curThread.join();//from   w w w  .ja v a2s.co m
            } catch (InterruptedException e) {
                e.printStackTrace();
                interrupted = true;
                break;
            }
        }
        return interrupted;
    }

    public static boolean joinThreads(Thread... threads) {
        return joinThreads(Arrays.asList(threads));
    }

    public static String join(Collection<String> strings, String separator) {
        StringBuilder sb = new StringBuilder();
        String sep = "";
        for (String s : strings) {
            if (s.length() > 0) {
                sb.append(sep).append(s);
                sep = separator;
            }
        }
        return sb.toString();
    }
}

Related

  1. joinStrings(List strings, String separator)
  2. joinStrings(List strings, String separator)
  3. joinStrings(String delim, List strings)
  4. joinStrings(String joiner, List objects)
  5. joinTextWithCommas(List list)
  6. joinTokens(final List tokens)
  7. joinToString(List list)
  8. JoinToString(List list, String delimiter)
  9. joinUnique(List list, T element)