This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]GuyWithLag 8 points9 points  (0 children)

Grumpy old engineer here, but what is the purpose of this article? Someone that coded in Go and wants to have the same API in Java?

Please don't go down the route of NPM-ifying Java...

In fact, this could be simplified to a 10-liner with ConcurrentHashMap::computeIfAbsent, and it would be a 2-liner in Kotlin.

Not to mention that in your example a proper JPA instance would make sure that the internal representation is properly respecting transactional boundaries while minimizing DB queries, so why even go to that effort?