本文整理了Java中io.vavr.control.Option.peek()
方法的一些代码示例,展示了Option.peek()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.peek()
方法的具体详情如下:
包路径:io.vavr.control.Option
类名称:Option
方法名:peek
[英]Applies an action to this value, if this option is defined, otherwise does nothing.
[中]如果定义了此选项,则对该值应用操作,否则不执行任何操作。
代码示例来源:origin: Tristan971/Lyrebird
private void launchUpdate(final String[] exec) {
stageManager.getSingle(Screen.ROOT_VIEW).peek(Stage::close);
SelfupdateService.displayRestartAlert();
SelfupdateService.installNewVersion(exec);
System.exit(0);
}
代码示例来源:origin: com.mercateo.eventstore/client-common
private Option<EventStore> createEventStore(EventStoreName eventStoreName) {
return eventStoreProperties
.get(eventStoreName)
.map(factory::createEventStore)
.peek(store -> store.peekLeft(error -> log.error("could not create event store client with name {}",
eventStoreName)))
.flatMap(Either::toOption);
}
}
内容来源于网络,如有侵权,请联系作者删除!