So basically I'm trying to remove some part of my list, but the problem is because I just got into android development, I don't know the format of the list that I got from JSON file. Here is the code of my method that retrieve it from a JSON file:
public void getCategory (JSONArray jsonArray, List<ModelCategory> Category){
for (int i = 0; i < jsonArray.length(); i++){
try {
ModelCategory currentCategory = new ModelCategory();
JSONObject jsonObject = jsonArray.getJSONObject(i);
currentCategory.setCategoryID(jsonObject.getInt("idCategory"));
currentCategory.setCategoryName(jsonObject.getString("name"));
Category.add(currentCategory);
kat1.addAll(Category);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Basically, I'm trying to remove the idCategory from the kat1 list. But I don't know what the list looks like. I've read about remove() method from the list, but how do I utilize the method to remove the idCategory?
I'm sorry for the unclear title, I'm pretty new to java development.