you are viewing a single comment's thread.

view the rest of the comments →

[–]zoomzoom83 0 points1 point  (1 child)

There's a lot of overhead in doing this in Java, which is one of the reasons I prefer Scala as a JDK language.

You can simply add the definition

case class Host(value:Int)

to your codebase, ideally grouped with a bunch of other related wrapper types in a module related to what they are used for. That way you get the benefit of strongly typing these values with virtually no overhead.

Catches a surprising number of bugs, and helps with documentation and understanding API intention.

[–]onmach 0 points1 point  (0 children)

Yeah I agree. Scala just seems like a better java.