本文整理汇总了Java中org.reactfx.value.Var.asList方法的典型用法代码示例。如果您正苦于以下问题:Java Var.asList方法的具体用法?Java Var.asList怎么用?Java Var.asList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.reactfx.value.Var
的用法示例。
在下文中一共展示了Var.asList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNullToValChange
import org.reactfx.value.Var; //导入方法依赖的package包/类
@Test
public void testNullToValChange() {
Var<String> src = Var.newSimpleVar(null);
LiveList<String> list = src.asList();
assertEquals(0, list.size());
List<ListModification<? extends String>> mods = new ArrayList<>();
list.observeModifications(mods::add);
src.setValue("foo");
assertEquals(1, mods.size());
ListModification<? extends String> mod = mods.get(0);
assertEquals(0, mod.getRemovedSize());
assertEquals(Collections.singletonList("foo"), mod.getAddedSubList());
assertEquals(1, list.size());
}
示例2: testValToNullChange
import org.reactfx.value.Var; //导入方法依赖的package包/类
@Test
public void testValToNullChange() {
Var<String> src = Var.newSimpleVar("foo");
LiveList<String> list = src.asList();
assertEquals(1, list.size());
List<ListModification<? extends String>> mods = new ArrayList<>();
list.observeModifications(mods::add);
src.setValue(null);
assertEquals(1, mods.size());
ListModification<? extends String> mod = mods.get(0);
assertEquals(Collections.singletonList("foo"), mod.getRemoved());
assertEquals(0, mod.getAddedSize());
assertEquals(0, list.size());
}
示例3: testValToValChange
import org.reactfx.value.Var; //导入方法依赖的package包/类
@Test
public void testValToValChange() {
Var<String> src = Var.newSimpleVar("foo");
LiveList<String> list = src.asList();
assertEquals(1, list.size());
List<ListModification<? extends String>> mods = new ArrayList<>();
list.observeModifications(mods::add);
src.setValue("bar");
assertEquals(1, mods.size());
ListModification<? extends String> mod = mods.get(0);
assertEquals(Collections.singletonList("foo"), mod.getRemoved());
assertEquals(Collections.singletonList("bar"), mod.getAddedSubList());
assertEquals(1, list.size());
}