briefly i am trying to display a list of Strings(without duplicates) with number of occurences at runtime.
i tried a Set but display only last element. public class AdapterProductCode extends ArrayAdapter {
Context context;
int layoutResourceId;
List<String> data = null;
//gets String from Activity one element at time
String a = data.get(position);
if (!data.contains(data.get(position))){
data.add(0, a);
}
Integer occurrences = Collections.frequency(data, a);
String total = Integer.toString(occurrences);
holder.txtLeft.setText(a);
holder.txtRight.setText(total);
the text view returns string the list of elements with number of occurences even duplicated elemnts.