本文整理汇总了Java中java8.util.Lists类的典型用法代码示例。如果您正苦于以下问题:Java Lists类的具体用法?Java Lists怎么用?Java Lists使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Lists类属于java8.util包,在下文中一共展示了Lists类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: end
import java8.util.Lists; //导入依赖的package包/类
@Override
public void end() {
Lists.sort(list, comparator);
downstream.begin(list.size());
if (!cancellationWasRequested) {
Iterables.forEach(list, downstream::accept);
} else {
for (T t : list) {
if (downstream.cancellationRequested()) {
break;
}
downstream.accept(t);
}
}
downstream.end();
list = null;
}
示例2: testOpWithNullSorted
import java8.util.Lists; //导入依赖的package包/类
@Test(dataProvider = "withNull:StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
public void testOpWithNullSorted(String name, TestData.OfRef<Integer> data) {
List<Integer> l = new ArrayList<>();
Lists.sort(data.into(l), cNullInteger);
// Need to inject SORTED into the sorted list source since
// sorted() with a comparator ironically clears SORTED
Collection<Integer> node = exerciseOps(new SortedTestData<>(l), Stream::distinct);
assertUnique(node);
assertSorted(node, cNullInteger);
}
示例3: ensureArrayCannotModifyList
import java8.util.Lists; //导入依赖的package包/类
@Test
public void ensureArrayCannotModifyList() {
String[] array = stringArray.clone();
List<String> list = Lists.of(array);
array[0] = "xyzzy";
assertEquals(list, Arrays.asList(stringArray));
}
示例4: copyOfResultsEqual
import java8.util.Lists; //导入依赖的package包/类
@Test
public void copyOfResultsEqual() {
List<Integer> orig = genList();
List<Integer> copy = Lists.copyOf(orig);
assertEquals(orig, copy);
assertEquals(copy, orig);
}
示例5: copyOfModifiedUnequal
import java8.util.Lists; //导入依赖的package包/类
@Test
public void copyOfModifiedUnequal() {
List<Integer> orig = genList();
List<Integer> copy = Lists.copyOf(orig);
orig.add(4);
assertNotEquals(orig, copy);
assertNotEquals(copy, orig);
}
示例6: copyOfIdentity
import java8.util.Lists; //导入依赖的package包/类
@Test
public void copyOfIdentity() {
List<Integer> orig = genList();
List<Integer> copy1 = Lists.copyOf(orig);
List<Integer> copy2 = Lists.copyOf(copy1);
assertNotSame(orig, copy1);
assertSame(copy1, copy2);
}
示例7: empty
import java8.util.Lists; //导入依赖的package包/类
@DataProvider(name="empty")
public Iterator<Object[]> empty() {
return Collections.singletonList(
a(Lists.of(), Collections.emptyList())
).iterator();
}
示例8: nonempty
import java8.util.Lists; //导入依赖的package包/类
@DataProvider(name="nonempty")
public Iterator<Object[]> nonempty() {
return asList(
a(Lists2.of("a"),
asList("a")),
a(Lists2.of("a", "b"),
asList("a", "b")),
a(Lists2.of("a", "b", "c"),
asList("a", "b", "c")),
a(Lists2.of("a", "b", "c", "d"),
asList("a", "b", "c", "d")),
a(Lists2.of("a", "b", "c", "d", "e"),
asList("a", "b", "c", "d", "e")),
a(Lists2.of("a", "b", "c", "d", "e", "f"),
asList("a", "b", "c", "d", "e", "f")),
a(Lists2.of("a", "b", "c", "d", "e", "f", "g"),
asList("a", "b", "c", "d", "e", "f", "g")),
a(Lists2.of("a", "b", "c", "d", "e", "f", "g", "h"),
asList("a", "b", "c", "d", "e", "f", "g", "h")),
a(Lists2.of("a", "b", "c", "d", "e", "f", "g", "h", "i"),
asList("a", "b", "c", "d", "e", "f", "g", "h", "i")),
a(Lists2.of("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"),
asList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")),
a(Lists2.of(stringArray),
asList(stringArray)),
a(Lists.of("a"),
asList("a")),
a(Lists.of("a", "b"),
asList("a", "b")),
a(Lists.of("a", "b", "c"),
asList("a", "b", "c")),
a(Lists.of("a", "b", "c", "d"),
asList("a", "b", "c", "d")),
a(Lists.of("a", "b", "c", "d", "e"),
asList("a", "b", "c", "d", "e")),
a(Lists.of("a", "b", "c", "d", "e", "f"),
asList("a", "b", "c", "d", "e", "f")),
a(Lists.of("a", "b", "c", "d", "e", "f", "g"),
asList("a", "b", "c", "d", "e", "f", "g")),
a(Lists.of("a", "b", "c", "d", "e", "f", "g", "h"),
asList("a", "b", "c", "d", "e", "f", "g", "h")),
a(Lists.of("a", "b", "c", "d", "e", "f", "g", "h", "i"),
asList("a", "b", "c", "d", "e", "f", "g", "h", "i")),
a(Lists.of("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"),
asList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")),
a(Lists.of(stringArray),
asList(stringArray))
).iterator();
}
示例9: nullDisallowed1
import java8.util.Lists; //导入依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void nullDisallowed1() {
Lists.of((Object) null); // force one-arg overload
}
示例10: nullDisallowed2a
import java8.util.Lists; //导入依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void nullDisallowed2a() {
Lists.of("a", null);
}
示例11: nullDisallowed2b
import java8.util.Lists; //导入依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void nullDisallowed2b() {
Lists.of(null, "b");
}
示例12: nullDisallowed3
import java8.util.Lists; //导入依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void nullDisallowed3() {
Lists.of("a", "b", null);
}
示例13: nullDisallowed4
import java8.util.Lists; //导入依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void nullDisallowed4() {
Lists.of("a", "b", "c", null);
}
示例14: nullDisallowed5
import java8.util.Lists; //导入依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void nullDisallowed5() {
Lists.of("a", "b", "c", "d", null);
}
示例15: nullDisallowed6
import java8.util.Lists; //导入依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void nullDisallowed6() {
Lists.of("a", "b", "c", "d", "e", null);
}