| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 
 |  
 public List autocomplete(Object suggest) {
        String pref = (String)suggest;
        ArrayList result = new ArrayList();
 
        Iterator iterator = getAllData().iterator();
        while (iterator.hasNext()) {
            Data elem = (Data) iterator.next();
            if ((elem != null && elem.getText().toLowerCase().indexOf(pref.toLowerCase()) == 0) || "".equals(pref))
            {
                result.add(elem);
            }
        }
        return result;
    }
 
    public ArrayList getCities() {
        return cities;
    }
 
    public void setCities(ArrayList cities) {
        this.cities = cities;
    }
 
    public ArrayList getAllData() {
        ArrayList result = new ArrayList();
        for (int i = 0; i < cit.length; i++) {
            Data data = new Data(cit[i], String.valueOf(i + 1));
            result.add(data);
        }
        return result;
    } | 
Partager