Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any Method in Java to find with out doing our own logic

No.
 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sir
 
Karthik Shiraly
Bartender
Posts: 1194
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can use Collections.frequency() to get the number of occurrences.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic