25+ yr Java/JS dev
Linux novice - running Ubuntu (no windows/mac)

  • 0 Posts
  • 103 Comments
Joined 1 year ago
cake
Cake day: June 14th, 2023

help-circle

  • I would only note that for the vast majority of my experience these streams can only return up to a single match. Determinism isn’t really preserved by findFirst, either, unless the sort order is set up that way.

    Finding the first Jim Jones in a table is no more reliable that finding any Jim Jones. But finding PersonId 13579 is deterministic whether you findFirst or findAny.

    Perhaps you work in a different domain where your experience is different.


  • I try to prefer .findAny() over .findFirst() because it will perform better in some cases (it will have to resolve whether there are other matches and which one is actually first before it can terminate - more relevant for parallel streams I think. findAny short circuits that) but otherwise I like the first. I’d probably go with some sort of composed predicate for the second, to be able to easily add new criteria. But I could be over engineering.

    I mostly just posted because I think not enough people are aware of the reasons to use findAny as a default unless findFirst is needed.












  • As I’ve gotten older, I find most of the stereotypes I grew up believing were bullshit and not particularly useful for classifying the subjects of the stereotype—however I do find they help me categorize the people who believe them.

    So you’re a white dude who thinks black people like fried chicken and watermelon? They do. So do white people because that shit is cheap and delicious. But you’re a racist.

    All cops are bad? The last few years have been revelatory about a problem that has existed for decades. But you’re a moral absolutist and not someone to discuss nuanced issues with.

    Republicans are better with the economy/foreign policy? You liked Regan and never grew out of it.

    The stereotypes themselves aren’t really useful, but understanding the speaker is sometimes helpful.






  • There is a need for heavy math in the field of programming, but most programmers will not ever need it. I’ve been a developer for over 25 years and I’ll bet I’ve never needed anything more complicated than Boolean algebra except for maybe 3 times. Which is infuriating when I get asked to write a stupid algorithm on every damn job interview. Like I think there is a need for maybe one math guy in a whole department.

    Most programming is not “web scale.” Even though every hiring manager seems to think their needs are particularly unusual or complex. With the exception of maybe the S&P 50 or something, they aren’t.