/** @deprecated since 3.0. */ @Deprecated @Test public void lazySelectForEach() { UnifiedSetWithHashingStrategy<Integer> integers = UnifiedSetWithHashingStrategy.newSetWith(INTEGER_HASHING_STRATEGY, 1, 2, 3, 4, 5); LazyIterable<Integer> select = integers.lazySelect(Predicates.lessThan(5)); Sum sum = new IntegerSum(0); select.forEach(new SumProcedure<Integer>(sum)); Assert.assertEquals(10, sum.getValue().intValue()); }
/** @deprecated since 3.0. */ @Deprecated @Test public void lazyCollectForEach() { UnifiedSetWithHashingStrategy<Integer> integers = UnifiedSetWithHashingStrategy.newSetWith(INTEGER_HASHING_STRATEGY, 1, 2, 3, 4, 5); LazyIterable<String> select = integers.lazyCollect(String::valueOf); Procedure<String> builder = Procedures.append(new StringBuilder()); select.forEach(builder); String result = builder.toString(); Verify.assertContains("1", result); Verify.assertContains("2", result); Verify.assertContains("3", result); Verify.assertContains("4", result); Verify.assertContains("5", result); }