本文整理汇总了Java中org.jooq.lambda.Unchecked.runnable方法的典型用法代码示例。如果您正苦于以下问题:Java Unchecked.runnable方法的具体用法?Java Unchecked.runnable怎么用?Java Unchecked.runnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jooq.lambda.Unchecked
的用法示例。
在下文中一共展示了Unchecked.runnable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jdk1_0
import org.jooq.lambda.Unchecked; //导入方法依赖的package包/类
/**
* Improvements on inter-operation with JDK 1.0 code
*/
private static void jdk1_0() {
Thread[] threads = {
// Pass a lambda to a thread
new Thread(() -> {
longOperation();
}),
// Pass a method reference to a thread
new Thread(ThreadGoodies::longOperation),
// Wrap lambdas throwing checked exceptions.
new Thread(Unchecked.runnable(ThreadGoodies::failingOperation))
};
// Start all threads
Arrays.stream(threads).forEach(Thread::start);
// Join all threads
Arrays.stream(threads).forEach(Unchecked.consumer(t -> t.join()));
}
示例2: unchecked
import org.jooq.lambda.Unchecked; //导入方法依赖的package包/类
/**
* @see {@link Unchecked#runnable(CheckedRunnable)}
*/
static Runnable unchecked(CheckedRunnable runnable) {
return Unchecked.runnable(runnable);
}