File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to find the number of occurences in a list using Java API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to find the number of occurences in a list using Java API" Watch "How to find the number of occurences in a list using Java API" New topic
Author

How to find the number of occurences in a list using Java API

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Dear All,

I want to know how to find the total number of ocuurences of each Object in an List is there any Method in Java to find with out doing our own logic
Please let me know with example


Creativity is nothing but Breaking Rules
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

is there any Method in Java to find with out doing our own logic

No.


[My Blog]
All roads lead to JavaRanch
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Thanks Sir
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 497
    
    5
Hi,

You can use Collections.frequency() to get the number of occurrences.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to find the number of occurences in a list using Java API