#horstmann-java8-for-really-impatient #java #java8
code to count words where length > 12 in traditional way:
int count = 0;
for (String w : words) {
if (w.length() > 12) count++;
}
in Java 8 would look like this:
count = words.stream().filter(w -> w.length() > 12).count();
If you want to change selection, open document below and click on "Move attachment"
pdf
owner:
piotr.wasik - (no access) - Java 8 for the Really Impatient (Horstmann), p22
Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details