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? -


There is an object like "set" in Java that can contain only unique string values, but it also includes a count Is the number of string value in number?

This idea is simple.

A data set, ALA ...

ABBCCC

I will set the text of each line set- I want to add to the object every time a non-unique text is added to the set, I also want to show a numeric value associated with the set to show how often it was added. So if I run it on the above data then set output will be something like this:

A: 1B: 2C: 3

Any ideas?

Maps & lt; String, integer & gt;

   
  add public null (strings) {if (map.containsKey (s)) {map.put (s, map.get (s) + 1); } And {map.put (S, 1); }}  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

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