From 372a8b225a68ae65e3e5ad04c803c47648255db5 Mon Sep 17 00:00:00 2001
From: Tagir Valeev
collection.stream().forEach() → collection.forEach()collection.stream().forEachOrdered() → collection.forEach()collection.stream().collect(Collectors.toList()) → new ArrayList<>(collection)collection.stream().collect(Collectors.toSet()) → new HashSet<>(collection)collection.stream().collect(Collectors.toCollection(CollectionType::new)) → new CollectionType<>(collection)collection.stream().collect(toList/toSet/toCollection()) → new CollectionType<>(collection)collection.stream().toArray() → collection.toArray()Arrays.asList().stream() → Arrays.stream() or Stream.of()IntStream.range(0, array.length).mapToObj(idx -> array[idx]) → Arrays.stream(array)IntStream.range(0, list.size()).mapToObj(idx -> list.get(idx)) → list.stream()Collections.singleton().stream() → Stream.of()Collections.singletonList().stream() → Stream.of()Collections.emptyList().stream() → Stream.empty()Collections.emptySet().stream() → Stream.empty()stream.filter().findFirst().isPresent() → stream.anyMatch()stream.filter().findAny().isPresent() → stream.anyMatch()stream.collect(Collectors.counting()) → stream.count()stream.collect(Collectors.maxBy()) → stream.max()stream.collect(Collectors.minBy()) → stream.min()stream.collect(Collectors.mapping()) → stream.map().collect()stream.collect(Collectors.reducing()) → stream.reduce() or Stream.map().reduce()stream.collect(Collectors.reducing()) → stream.reduce()stream.collect(Collectors.summingInt()) → stream.mapToInt().sum()stream.collect(Collectors.summingLong()) → stream.mapToLong().sum()stream.collect(Collectors.summingDouble()) → stream.mapToDouble().sum()stream.mapToObj(x -> x) → stream.boxed()!stream.anyMatch() → stream.noneMatch()!stream.anyMatch(x -> !(...)) → stream.allMatch()!stream.noneMatch() → stream.anyMatch()stream.noneMatch(x -> !(...)) → stream.allMatch()stream.allMatch(x -> !(...)) → stream.noneMatch()!stream.allMatch(x -> !(...)) → stream.anyMatch()stream.map().anyMatch(Boolean::booleanValue) -> stream.anyMatch()stream.map().allMatch(Boolean::booleanValue) -> stream.allMatch()stream.map().noneMatch(Boolean::booleanValue) -> stream.noneMatch()Note that the replacements semantic may have minor difference in some cases.