Ejemplo n.º 1
0
 @Test
 public void injectIntoLong() {
   ImmutableBag<Integer> integers = this.newBag().collect(Integer::valueOf);
   long result = integers.injectInto(0, AddFunction.INTEGER_TO_LONG);
   Assert.assertEquals(
       FastList.newList(integers).injectInto(0, AddFunction.INTEGER_TO_INT), result);
 }
Ejemplo n.º 2
0
 @Test
 public void injectIntoFloat() {
   ImmutableBag<Integer> integers = this.newBag().collect(Integer::valueOf);
   float result = integers.injectInto(0, AddFunction.INTEGER_TO_FLOAT);
   float expected = FastList.newList(integers).injectInto(0, AddFunction.INTEGER_TO_FLOAT);
   Assert.assertEquals(expected, result, 0.001);
 }
Ejemplo n.º 3
0
 @Test
 public void injectInto() {
   ImmutableBag<Integer> integers = this.newBag().collect(Integer::valueOf);
   Integer result = integers.injectInto(0, AddFunction.INTEGER);
   Assert.assertEquals(
       FastList.newList(integers).injectInto(0, AddFunction.INTEGER_TO_INT), result.intValue());
   String result1 = this.newBag().injectInto("0", String::concat);
   Assert.assertEquals(FastList.newList(this.newBag()).injectInto("0", String::concat), result1);
 }