本文整理了Java中io.vavr.control.Either.getOrElse()
方法的一些代码示例,展示了Either.getOrElse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Either.getOrElse()
方法的具体详情如下:
包路径:io.vavr.control.Either
类名称:Either
方法名:getOrElse
[英]Gets the Right value or an alternate value, if the projected Either is a Left.
[中]如果投影的值是左值,则获取右值或备用值。
代码示例来源:origin: vavr-io/vavr
/**
* Gets the Right value or an alternate value, if the projected Either is a Left.
*
* @param other an alternative value
* @return the right value, if the underlying Either is a Right or else {@code other}
* @throws NoSuchElementException if the underlying either of this RightProjection is a Left
*/
@Override
public R getOrElse(R other) {
return either.getOrElse(other);
}
代码示例来源:origin: io.vavr/vavr
/**
* Gets the Right value or an alternate value, if the projected Either is a Left.
*
* @param other an alternative value
* @return the right value, if the underlying Either is a Right or else {@code other}
* @throws NoSuchElementException if the underlying either of this RightProjection is a Left
*/
@Override
public R getOrElse(R other) {
return either.getOrElse(other);
}
代码示例来源:origin: com.github.robozonky/robozonky-app
@Override
public final String toString() {
return toString.get().getOrElse("ERROR");
}
}
代码示例来源:origin: RoboZonky/robozonky
@Override
public final String toString() {
return toString.get().getOrElse("ERROR");
}
}
代码示例来源:origin: RoboZonky/robozonky
private Set<OffsetDateTime> getTimestamps() {
return timestamps.get().getOrElse(Collections.emptySet());
}
代码示例来源:origin: com.github.robozonky/robozonky-notifications
private Set<OffsetDateTime> getTimestamps() {
return timestamps.get().getOrElse(Collections.emptySet());
}
代码示例来源:origin: RoboZonky/robozonky
@Override
public void close() {
isClosed.set(true);
if (!token.hasValue()) {
LOGGER.debug("Nothing to close.");
return;
}
final ZonkyApiToken toClose = token.get().getOrElse(() -> null);
if (toClose == null || toClose.isExpired()) {
LOGGER.debug("Nothing to close or expired.");
return;
}
LOGGER.info("Logging '{}' out of scope '{}'.", secrets.getUsername(), scope);
apis.run(Zonky::logout, () -> toClose);
}
}
内容来源于网络,如有侵权,请联系作者删除!