I was recently going through one of the Netflix open source project
There I found use of both final class along with private constructor. I fully aware that
- final is to avoid inheritance
- private is to disallow instantiation
But m just curious to know why they are both used together. Although methods are static, so we can use them without instantiation but still eager to know design principle behind it.
With this code you will have this features
extends
) your classIn this case I can't see a singleton pattern to get an instance, so, IMHO, you're looking to a helper/util class in the Netflix API, where the developer team used some standard practices to ensure users use their classes in the correct way:
Also, looking at the class you linked:
And:
ADD ON:
If you want further info, take a look at
Item 4
from Joshua Bloch's Effective Java (2nd Edition):