删除重复项数组列表 android

remove duplicate item arraylist android

这里我试图显示从 mysql 数据库中获取的状态列表,代码正在显示该列表,但同一项目被显示了多次。

请帮助删除此处的重复条目我正在粘贴我的函数

protected void showList()
{
    try{
        JSONObject jsonObj = new JSONObject(myJSON);
        peoples = jsonObj.getJSONArray(TAG_RESULTS);

        for(int i=0;i<peoples.length();i++){
            JSONObject c = peoples.getJSONObject(i);
           // String loc = c.getString(TAG_LOCATION);
            //String dist = c.getString(TAG_DIST);
            String state = c.getString(TAG_STATE);


            HashMap<String,String> persons = new HashMap<String,String>();

            //persons.put(TAG_LOCATION,loc);
            //persons.put(TAG_DIST,dist);

            if(!personList.contains(state.toString())) {
                persons.put(TAG_STATE, state);
                personList.add(persons);
            }
        }

        ListAdapter adapter = new SimpleAdapter(
                Location.this,personList,R.layout.simple_list_item_1,
                new String[]{TAG_STATE},
                new int[]{R.id.tvLocation}
        );
        list.setAdapter(adapter);
    }catch (JSONException e){
        e.printStackTrace();
    }
    pd1.dismiss();

}
persons.put(TAG_STATE, state);  

if (!personList.contains(persons)) {
  // take this to top and then check 
  //persons.put(TAG_STATE, state); 
  personList.add(persons);
}