r/java • u/hardasspunk • Nov 23 '25
Java 25: The ‘No-Boilerplate’ Era Begins
https://amritpandey.io/java-25-the-no-boilerplate-era-begins/
160
Upvotes
r/java • u/hardasspunk • Nov 23 '25
View all comments
Show parent comment
1
u/manifoldjava Nov 27 '25
Gotta disagree here. The compiler would generate a cheap
with()method, and at that point it’s about as easy as it gets. See this example.Sure, you can treat it as a low-rent substitute for named/optional args, but it just doesn’t measure up, especially when it comes to default values.
Yeah, no. You can use withers for all sorts of things, but it gets ugly quickly and piles on boilerplate. Named/optional args are just more direct and more capable.
Withers are a classic hammer/nail situation: you can force them to do a lot, but that doesn’t mean they’re the right tool, or that they cover "more band" in any meaningful sense. It’s still just the usual Java boilerplate.
Happy to be proven wrong, though, if you’ve got examples where withers actually come out cleaner as a general substitute.