protected Map compute() { if (files.isEmpty()) { return Collections.emptyMap(); } if (files.size() == 1) { return count(files.get(0)); } int mid = files.size() / 2; CountWord left = new CountWord(files.subList(0, mid)); CountWord right = new CountWord(files.subList(mid, files.size())); left.fork(); right.fork(); return Stream.of(left.join(), right.join()) .flatMap(map -> map.entrySet().stream()) .collect(Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue,
標(biāo)簽: