From 9a1db2b89802300ba8bc8494bdc4468c70316252 Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Mon, 2 Mar 2026 21:02:10 +0800 Subject: [PATCH 1/2] Fix conclusion in Hamming approach The information about one of the IntStream being more efficient just because it has less steps is incorrect because the extra steps does not result in additional iterations. In regards to the `for` loop, while the one shown does not show a `final` field, it does not mean that the code can be written in such a way that it is final. Fixes #3090 --- exercises/practice/hamming/.approaches/introduction.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/exercises/practice/hamming/.approaches/introduction.md b/exercises/practice/hamming/.approaches/introduction.md index 8ef5c7816..c75c20262 100644 --- a/exercises/practice/hamming/.approaches/introduction.md +++ b/exercises/practice/hamming/.approaches/introduction.md @@ -127,11 +127,6 @@ For more information, check the [`IntStream` with `reduce()` approach][approach- Since benchmarking with the [Java Microbenchmark Harness][jmh] is currently outside the scope of this document, the choice between the various approaches can be made by perceived readability. -Of the `IntStream` approaches, the `reduce()` approach likely might be fastest, as it is only one iteration -instead of an iteration for `filter()` or `map()` and another iteration for `count()` or `sum()`. - -The `for` loop may also be fast, but it leaves a mutable member variable for the distance, instead of one marked [`final`][final]. - [for]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html [intstream]: https://docs.oracle.com/javase/8/docs/api/java/util/stream/IntStream.html [filter]: https://docs.oracle.com/javase/8/docs/api/java/util/stream/IntStream.html#filter-java.util.function.IntPredicate- From 40478711d766fdb4688381f9a6f1845e6b6ff76e Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Tue, 3 Mar 2026 09:00:36 +0800 Subject: [PATCH 2/2] Remove unused link Link no longer used since previous commit. --- exercises/practice/hamming/.approaches/introduction.md | 1 - 1 file changed, 1 deletion(-) diff --git a/exercises/practice/hamming/.approaches/introduction.md b/exercises/practice/hamming/.approaches/introduction.md index c75c20262..14ed9be2d 100644 --- a/exercises/practice/hamming/.approaches/introduction.md +++ b/exercises/practice/hamming/.approaches/introduction.md @@ -139,4 +139,3 @@ the choice between the various approaches can be made by perceived readability. [approach-intstream-map-sum]: https://exercism.org/tracks/java/exercises/hamming/approaches/intstream-map-sum [approach-intstream-reduce]: https://exercism.org/tracks/java/exercises/hamming/approaches/intstream-reduce [jmh]: https://github.com/openjdk/jmh -[final]: https://en.wikibooks.org/wiki/Java_Programming/Keywords/final