Closed yegor256 closed 2 years ago
@yegor256 there are no "array" interface and an array is everything but an object, while in cactoos, the main OO abstraction for manipulating data such as collections, array, etc is Iterable
which is lazy by nature.
The classes in that package should be enough to map over an array, you will end up with an Iterable
, and if you want to materialize it into an array, the recommend approach is to pass it then to ListOf
onto which you can call toArray
like so:
int[] arr = { 1, 2, 3 }
new org.cactoos.list.ListOf(
new org.cactoos.iterable.Mapped(e -> e*2, arr)
).toArray(int[]::new);
@victornoel got it, thanks
How about a new package for manipulations with arrays? A
Mapped
one would be useful, and others too.