I'm a big fan fan of enum singletons. This case looks like an enum with no values for utility methods to avoid a private ctor, I haven't used enums this way myself. I think the trade-off is between avoiding having to write a private constructor to prevent extension, and the downside of enum static methods e.g. Uris.values(), Uris.valueOf(String), Uris.valueOf(Class,String) which could be argued violate the principle of least astonishment. I don't have much of an opinion on enum utility methods.
On Tue, Nov 17, 2020, at 15:48, Volkan Yazıcı wrote: > I use enums for singletons, which is the recommended way to create > singletons in Effective Java by Joshua Bloch. Given I have used it in some > other places as well and heard no complaints so far, I did not convert them > to a final class with a private ctor. Should I? > > On Tue, Nov 17, 2020 at 9:25 PM Gary Gregory <garydgreg...@gmail.com> wrote: > > > Hi all, > > > > Why is this an enum and not a class? > > > > Gary > > >