use of javaslang.Tuple in project javaslang by javaslang.
the class AbstractMapTest method shouldUnzip3NonNil.
@Test
public void shouldUnzip3NonNil() {
final Map<Integer, Integer> map = emptyIntInt().put(0, 0).put(1, 1);
final Tuple actual = map.unzip3(entry -> Tuple.of(entry._1, entry._2 + 1, entry._2 + 5));
final Tuple expected = Tuple.of(Stream.of(0, 1), Stream.of(1, 2), Stream.of(5, 6));
assertThat(actual).isEqualTo(expected);
}
use of javaslang.Tuple in project javaslang by javaslang.
the class AbstractMapTest method shouldUnzipIdentityNonNil.
@Test
public void shouldUnzipIdentityNonNil() {
final Map<Integer, Integer> map = emptyIntInt().put(0, 10).put(1, 11).put(2, 12);
final Tuple actual = map.unzip();
final Tuple expected = Tuple.of(Stream.of(0, 1, 2), Stream.of(10, 11, 12));
assertThat(actual).isEqualTo(expected);
}
use of javaslang.Tuple in project javaslang by javaslang.
the class CharSeqTest method shouldUnzip3NonNil.
@Test
public void shouldUnzip3NonNil() {
final Tuple actual = of('0', '1').unzip3(i -> Tuple.of(i, i == '0' ? 'a' : 'b', i == '0' ? 'b' : 'a'));
final Tuple expected = Tuple.of(Vector.of('0', '1'), Vector.of('a', 'b'), Vector.of('b', 'a'));
assertThat(actual).isEqualTo(expected);
}
use of javaslang.Tuple in project javaslang by javaslang.
the class AbstractTraversableTest method shouldUnzipNonNil.
@Test
public void shouldUnzipNonNil() {
final Tuple actual = of(0, 1).unzip(i -> Tuple.of(i, (char) ((short) 'a' + i)));
final Tuple expected = Tuple.of(of(0, 1), of('a', 'b'));
assertThat(actual).isEqualTo(expected);
}
use of javaslang.Tuple in project javaslang by javaslang.
the class AbstractMultimapTest method shouldUnzipNonNil.
@Test
public void shouldUnzipNonNil() {
final Multimap<Integer, Integer> map = emptyIntInt().put(0, 0).put(1, 1);
final Tuple actual = map.unzip(entry -> Tuple.of(entry._1, entry._2 + 1));
final Tuple expected = Tuple.of(Stream.of(0, 1), Stream.of(1, 2));
assertThat(actual).isEqualTo(expected);
}
Aggregations