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

Is there an open source WebSockets (JavaScript) XMPP library? -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

iphone - How do I make a UIPickerView in a UIActionSheet -