标签:main final imp string rip ref nts range rgs
package service;
import java.util.stream.IntStream;
/**
* @description: 给线程命名
* @author:
* @create:
**/
public class NamedThreads {
public static final String PREFIX = "NO-";
public static void main(String[] args) {
IntStream.range(0, 5).boxed().map(NamedThreads::createThread).forEach(Thread::start);
}
private static Thread createThread(final int intName){
return new Thread(() -> System.out.println(Thread.currentThread().getName()),
PREFIX + intName);
}
}
标签:main final imp string rip ref nts range rgs
原文地址:https://www.cnblogs.com/herosoft/p/9473493.html