I have an app in which contain ArrayList of some String let suppose a,b,c,d and i have a String called pack. What i have to do is that i have to check whether pack is already exist in arraylist or not if not exist then i have to add it in arraylist. How do i do that
code:-
ArrayList<CBlackList> appsListDataSet;
public void setAppsDetails(String pack) {
if (appsListDataSet != null && appsListDataSet.size() > 0) {
for (int i = 0; i < appsListDataSet.size(); i++) {
CAppsModel appsModel = appsListDataSet.get(i);
if (pack.equalsIgnoreCase(appsModel.getPackageName())){
//Not to know what to do here.
}
}
}
}