bc0026c3e1
Plus many new examples in "streams" chapter.
15 lines
268 B
Java
15 lines
268 B
Java
// onjava/Sleep.java
|
|
// Sleep for n seconds.
|
|
package onjava;
|
|
import java.util.concurrent.*;
|
|
|
|
public class Sleep {
|
|
public Sleep(int n) {
|
|
try {
|
|
TimeUnit.SECONDS.sleep(n);
|
|
} catch(InterruptedException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|