This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 489
    
    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
 
Similar Threads
find missing numbers in given billion number
Software Development Engineer, Amazon, Seattle, USA [2007-07-17]
Generics Wildcard Covariance
Arithmetic Overflow in exercise 4b
List Permutation