我有一个数组列表。我需要通过它,看看输入时是否有一个元素。这个怎么做?
DatabaseUtil dbUtil1 = new DatabaseUtil(this);
dbUtil1.open();
Boolean contain=false;
Cursor cursor = dbUtil1.fetchAllElements();
if (cursor != null) {
while (cursor.moveToNext()) {
Model s= new Model(cursor.getString(1),cursor.getString(2));
if (list.contains(s)) //THIS DOES NOT WORK
{
contain=true;
}
else
{
list.add(get(cursor.getString(1),cursor.getString(2)));
}
}
}
dbUtil1.close();