Java creating max 3 objects of a class -


when want create 1 object of class, use singleton design pattern. want create maximum 3 or 5 objects of class. there way restrict maximum number of object creation in java?

of course implement singleton-like feature rather easily, you're apparently looking object pool.

there many implementations of such pools, notable 1 apache commons/pool


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -