I'm testing some applications in our service that do GeoIP queries using MaxMind GeoIP databases. The MaxMind data (CSV) is a list of CIDR formated subnets and for a given subnet I need to get a list/array of IPv6 Addresses to feed our service for testing. While I can use the iterator and manually limit the loop, supporting streams would be a nice feature.
Something like the following (my syntax may not be perfect...I'm learning lambdas and streams still):
IPv6Network network = IPv6Network.fromString("2c0f:f628::/32");
List<IPv6Address> = network.stream()
.skip(1) //skip the network address
.limit(1000) //Give me 1000
.collect(toList()); // as a list
I'm testing some applications in our service that do GeoIP queries using MaxMind GeoIP databases. The MaxMind data (CSV) is a list of CIDR formated subnets and for a given subnet I need to get a list/array of IPv6 Addresses to feed our service for testing. While I can use the iterator and manually limit the loop, supporting streams would be a nice feature.
Something like the following (my syntax may not be perfect...I'm learning lambdas and streams still):