I have a requirement: there is a class and only 10 instances of this class can exist in application. when application tries to create 11th instance, either null or exception should generate. where ever needed in application, one instance out of 10 instances can be used.
how can i implement this requirement in my application.
can i use singleton pattern where getInstance() method create new instance till 10 times and in 11th time, it return existing instance? or singleton mean only one instance()?