本文整理了Java中com.spotify.mobius.Next.modelOrElse()
方法的一些代码示例,展示了Next.modelOrElse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Next.modelOrElse()
方法的具体详情如下:
包路径:com.spotify.mobius.Next
类名称:Next
方法名:modelOrElse
[英]Try to get the model from this Next, with a fallback if there isn't one.
[中]下一步,尝试从这个模型中获取模型,如果没有模型,则使用备用方案。
代码示例来源:origin: spotify/mobius
@Nonnull
synchronized Next<M, F> update(E event) {
Next<M, F> next = update.update(currentModel, checkNotNull(event));
currentModel = next.modelOrElse(currentModel);
return next;
}
}
代码示例来源:origin: com.spotify.mobius/mobius-core
@Nonnull
synchronized Next<M, F> update(E event) {
Next<M, F> next = update.update(currentModel, checkNotNull(event));
currentModel = next.modelOrElse(currentModel);
return next;
}
}
代码示例来源:origin: spotify/mobius
@Test
public void canMergeInnerEffectsAndModel() throws Exception {
Set<String> effects = setOf("f1", "f2");
Next<Integer, String> innerNext = Next.next(1, effects("f2", "f3"));
Next<String, String> merged =
Next.next("m" + innerNext.modelOrElse(0), unionSets(effects, innerNext.effects()));
assertEquals(Next.next("m1", effects("f1", "f2", "f3")), merged);
}
代码示例来源:origin: spotify/mobius
@Test
public void canMergeInnerEffects() throws Exception {
Next<String, String> outerNext = Next.next("m", effects("f1", "f2"));
Next<?, String> innerNext = dispatch(effects("f2", "f3"));
Next<String, String> merged =
Next.next(
outerNext.modelOrElse("fail"), unionSets(innerNext.effects(), outerNext.effects()));
assertEquals(Next.next("m", effects("f1", "f2", "f3")), merged);
}
内容来源于网络,如有侵权,请联系作者删除!