What methods should go into a java.util.Objects class in JDK 7? (original) (raw)

Joseph D. Darcy Joe.Darcy at Sun.COM
Sat Oct 10 01:38:40 UTC 2009


Paul Benedict wrote:

Joe,

I think java.util.Objects could benefit from the "final" modifier. Since its constructor always fails, there is no reason to subclass it (i.e., super constructor always fails). I believe Josh's "Effective Java" book makes such a point about static utility classes. Paul

Hello.

Classes with only private constructors, like j.u.Objects, are effectively final. Adding final is harmless but unnecessary in these cases. The platform is a bit inconsistent here; j.u.Collections is not marked final while j.l.Math is. In practice, it doesn't matter very much; I'll consider final-izing j.u.Objects on the next round of edits.

-Joe



More information about the core-libs-dev mailing list