Java tutorial
//package com.java2s; import java.util.function.Consumer; public class Main { public static <T> void runInThread(Consumer<T> consumer, T element) { Runnable runnable = () -> consumer.accept(element); new Thread(runnable).start(); } }