Then those objects should be coded in such a way that you can keep track of them. In particular you need code which increments a counter when one of them is created and code which decrements that counter when one of them is garbage-collected.
Thanks Paul. Really appreciate your comment. The problem is that I have no control over the objects that got sent to me. I have no way to modify those objects.
Here is an illustration:
The program may receive Java objects such as String, Integer, Double, .., I like to classify, group and count those objects. In the end, I would like to know
x number of String objects
y number of Integer objects
z number of Double objects
further more, for "x number of String objects", I would like to know x1 number of String objects start with "a"; for y number of Integer objects, I like to find how many there are positive vs negative. ...
Thanks for responses. Well, it's a bit hard to argue with sales/marketing. I need to develop a reporting system. There are some objects that have common interface. The other are really hard to know in advance. I just assume they are inherited from Object.