List<String> source = ...; List<Integer> target = ...; source.stream() .map(String::length) .forEachOrdered(target::add);