Java - Retrieving amount of types in list -


I have a list, the list may contain several items of the same type.

Let's say that I have an enum: TOY in which the value is: ball , DOLL , PLAYSTATION . I want to know that there are a list with PLAYSTATION item TOY . (I.e., list & lt; toy & gt; toys)

What is the best possible solution for this? I do not want to keep it through the list every time.

You can use ' hashbags . There is a getCount (object) method that will suit you.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -