Hacker News new | ask | show | jobs
by giaour 1867 days ago
"With" doesn't exist in Java, but it was introduced in C# 9.0 as part of the .NET implementation of records:

https://devblogs.microsoft.com/dotnet/c-9-0-on-the-record/#w...

I think the author is more saying that a "with" operator would fit into Java record semantics but might not be compatible with Lombok @Data classes or Kotlin data classes (though it looks from your link that Kotlin actually does have something very similar in the "copy" method).

1 comments

Not sure why this is getting downvoted; if you look at the hypothetical “with” syntax in the original blog post, it is clearly borrowed from the C# implementation.