Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ThreadFactory; public class Main { public static ThreadFactory setThreadNameWithID(String name) { return (Runnable r) -> new Thread(r, String.format("%s-%s", name, r.hashCode())); } }