java - Joining multiple IntStream -
this question has answer here:
i trying integers, getting on stream, however, being added new stream of integers using later on.
to populate new stream of integers, make multiple intstreams , append them new 1 using intstream builder, such:
is there better way approach this:
intstream rightside = intstream.range(8, this.rows.getslotamount()).map(value -> value + 9); intstream leftside = intstream.range(0, this.rows.getslotamount()).map(value -> value % 9); intstream top = intstream.range(0, 9); intstream bottom = intstream.range(this.rows.getslotamount() - 9, this.rows.getslotamount()); intstream.builder slots = intstream.builder(); rightside.foreach(slots::add); leftside.foreach(slots::add); top.foreach(slots::add); bottom.foreach(slots::add); slots.build().foreach(this::methodreference);
whenever seeing multiple streams, think flatten. hope helps.
stream.of(rightside, leftside, top, bottom).flatmaptoint(x -> x)
Comments
Post a Comment