How can we detect redundant rows.and maintain their count.
if the rows are like

the result i want is
11111 4
10101 1

Recommended Answers

All 3 Replies

Create a Map with the row values as key and an Integer count as value.
For each row, if that value is already in the map, increment its count. If it's not in the map add it with a count of 1.
You may need some convenient representation for the row values - eg convert the row to a single String

cant it be done with use of 2d array.Actually i have no idea how to use map.

Why not put it in a set?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.