Let's say I have an array/arraylist(doesn't matter) with the following content: 2, 2, 2, 4, 5, 5, 8, 8, 8.
How wold I go about counting the different values, in other words; how would I find out that there are 3 twos, one 4, 2 fives and 3 eights.
How would like to get an attay(or arraylist for that matter) with the content: 3, 1, 2, 3.
How would I go about doing that?
efth
0
Newbie Poster
Recommended Answers
Jump to Postuse an array that increments its element depending on the value of the reference array/arraylist as you iterate over it
the index of the counting array would depend on which value the current reference array has
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.