Is there a storage class that counts occurrence of an item? It don't seem
to see any, it seems kind of odd.
i.e.,
LinkedList<String> words;
words.add("one");
words.add("two");
words.add("one");
System.out.println(
"the work 'one' appears this many times: "+
words.count("one"));
I know it is trivial to implement, but it just seems that it should be a
part of the Collection or List interface.
Thanks,
~S
Bjorn Abelli - 09 Apr 2005 02:18 GMT
"Shea Martin" wrote...
> Is there a storage class that counts occurrence of an item? It don't seem
> to see any, it seems kind of odd.
Look at Collections.frequency(...).
// Bjorn A
shea martin - 09 Apr 2005 05:00 GMT
> "Shea Martin" wrote...
>
[quoted text clipped - 4 lines]
>
> // Bjorn A
Thanks.
~S