use of suite.primitive.IntIntSource in project suite by stupidsing.
the class IntIntMap1 method streamlet.
public IntObjStreamlet<Integer> streamlet() {
return new IntObjStreamlet<>(() -> {
IntIntSource source = source_();
IntIntPair pair0 = IntIntPair.of(0, 0);
return IntObjOutlet.of(new IntObjSource<Integer>() {
public boolean source2(IntObjPair<Integer> pair) {
boolean b = source.source2(pair0);
if (b)
pair.update(pair0.t0, pair0.t1);
return b;
}
});
});
}
use of suite.primitive.IntIntSource in project suite by stupidsing.
the class IntIntMap1 method forEach.
public void forEach(IntIntSink sink) {
IntIntPair pair = IntIntPair.of(0, 0);
IntIntSource source = source_();
while (source.source2(pair)) sink.sink2(pair.t0, pair.t1);
}
use of suite.primitive.IntIntSource in project suite by stupidsing.
the class IntIntMapTest method test.
@Test
public void test() {
IntIntMap map = new IntIntMap();
map.put(1, 2);
map.put(3, 4);
map.put(5, 6);
assertEquals(2, map.get(1));
assertEquals(4, map.get(3));
assertEquals(6, map.get(5));
Set<String> expected = new HashSet<>();
expected.add("1:2");
expected.add("3:4");
expected.add("5:6");
Set<String> actual = new HashSet<>();
IntIntSource source = map.source();
IntIntPair pair = IntIntPair.of(0, 0);
while (source.source2(pair)) actual.add(pair.t0 + ":" + pair.t1);
assertEquals(expected, actual);
}
use of suite.primitive.IntIntSource in project suite by stupidsing.
the class IntIntMap method forEach.
public void forEach(IntIntSink sink) {
IntIntPair pair = IntIntPair.of((int) 0, (int) 0);
IntIntSource source = source_();
while (source.source2(pair)) sink.sink2(pair.t0, pair.t1);
}
Aggregations