java how to get all threads

Java
Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
Source

Also in Java: