Java tutorial
//package com.java2s; //License from project: Apache License import android.widget.ArrayAdapter; import java.util.List; public class Main { public static void fillLeftList(String[] pairsList, List<String> namesList, ArrayAdapter<String> adapter) { String[] names; if (pairsList.length != 0) { namesList.clear(); for (String s : pairsList) { names = s.split("-"); if (!namesList.contains(names[0])) { namesList.add(names[0]); } } if (adapter != null) { adapter.notifyDataSetChanged(); } } } }