doubt in collection

hi all..how do i find the no.of occurance from a object using Collection class......can any1 help me out................
[134 byte] By [3dguna] at [2007-11-27 3:41:35]
# 1
Collections.frequency(myCollection, myObject);
-Kayaman-a at 2007-7-12 8:45:07 > top of Java-index,Java Essentials,Java Programming...
# 2

[Edit] Forget the following...

It depends on the class.

If it implements the Set interface then a reference to the object will occur at most once. So just use contains() to see if it's there or not.

Otherwise use the fact that Collection extends Iterable and ... iterate over the class counting the numebr of times it contains a reference to the object you are interested in.

pbrockway2a at 2007-7-12 8:45:07 > top of Java-index,Java Essentials,Java Programming...