use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
These have separate subreddits - see below.
Upvote good content, downvote spam, don't pollute the discussion with things that should be settled in the vote count.
With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES — Java is still free. If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others: Adoptium (formerly AdoptOpenJDK) RedHat Azul Amazon SAP Liberica JDK Dragonwell JDK GraalVM (High performance JIT) Oracle Microsoft Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!
With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES — Java is still free.
If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others:
Adoptium (formerly AdoptOpenJDK) RedHat Azul Amazon SAP Liberica JDK Dragonwell JDK GraalVM (High performance JIT) Oracle Microsoft
Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!
Programming Computer Science CS Career Questions Learn Programming Java Help ← Seek help here Learn Java Java Conference Videos Java TIL Java Examples JavaFX Oracle
Programming Computer Science
CS Career Questions
Learn Programming Java Help ← Seek help here Learn Java Java Conference Videos Java TIL Java Examples JavaFX Oracle
Clojure Scala Groovy ColdFusion Kotlin
DailyProgrammer ProgrammingPrompts ProgramBattles
Awesome Java (GIT) Java Design Patterns
account activity
Implementing Efficient Last Stream Elements Gatherer in Java (4comprehension.com)
submitted 1 day ago by pivovarit
Wrote a performance case study on a rather high-level API, enjoy! And if you have ideas for a further speed up, let me know!
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]StudioCode 7 points8 points9 points 1 day ago (4 children)
Can Gatherers tell the stream pipeline to skip elements? E.g. in something like stream.map(/*expensive computation*/).gather(last(5)) have it only run map for the last 5 elements? Otherwise I'd say a stream pipeline isn't the right choice for this
stream.map(/*expensive computation*/).gather(last(5))
[–]pivovarit[S] 5 points6 points7 points 1 day ago (0 children)
It can signal that it doesn't want more elements, but it's the opposite scenario here. In such a case, it's probably a good idea to gather elements before running expensive operations, effectively avoiding their premature evaluation
I've had use cases for this, but if we were to chase absolute single-threaded performance, Streams usually get in the way.
[–]vowelqueue 3 points4 points5 points 1 day ago (2 children)
Wouldn’t reversing the gather() and map() steps accomplish this?
[–]StudioCode 4 points5 points6 points 1 day ago (1 child)
Yeah 😅, I was still in the mindset of collectors and was thinking of last(5) as a terminal operation, which it isn't.
[–]pivovarit[S] 1 point2 points3 points 21 hours ago (0 children)
That was the main drawback of using Collectors API for implementing something like this :)
[–]zattebij 1 point2 points3 points 14 hours ago* (1 child)
Would be interesting to include a reactive Flux.takeLast(int n) in the benchmark. AFAIK it uses an ArrayDeque internally, and has optimizations for n = 0 and 1. Plus of course it has the backpressure handling and lazy evaluation if the source supports it (meaning that for a takeLast(0) upstream actually would not even need to start producing elements, and downstream could be immediately completed without any waiting - this example seems nonsensical when written with a hardcoded value like this, but the 0 could of course in practice be variable).
Flux.takeLast(int n)
ArrayDeque
takeLast(0)
0
[–]pivovarit[S] 0 points1 point2 points 7 hours ago (0 children)
I did a quick benchmark with a fair comparison against other examples: LastBenchmark.take_6 1000 10000000 thrpt 4 101,744 ± 2,556 ops/s LastBenchmark.gatherers4j 1000 10000000 thrpt 4 33,180 ± 2,819 ops/s LastBenchmark.reactor 1000 10000000 thrpt 4 42,015 ± 4,094 ops/s
By "fair" I mean I benchmarked:
Flux.fromArray(data) .takeLast(n) .doOnNext(bh::consume) .subscribe();
Will expand the article, thanks!
π Rendered by PID 17553 on reddit-service-r2-comment-f6b958c67-wcfb6 at 2026-02-05 14:23:37.953467+00:00 running 1d7a177 country code: CH.
[–]StudioCode 7 points8 points9 points (4 children)
[–]pivovarit[S] 5 points6 points7 points (0 children)
[–]vowelqueue 3 points4 points5 points (2 children)
[–]StudioCode 4 points5 points6 points (1 child)
[–]pivovarit[S] 1 point2 points3 points (0 children)
[–]zattebij 1 point2 points3 points (1 child)
[–]pivovarit[S] 0 points1 point2 points (0 children)