I'm new to Java and I have created a list like

```
List<TruckCategoriesModel> catvals = truckcatesq.getLocationTruckCategories("tryone"));

```

My `TruckCategoriesModel` contains

```
private String category,header_loc;
private int db_id;
//getters and setters for the above

```

Now after some calculations I have several indexes with represent category. I have a list in which contains a list e.g.

```
fruit, juice, mango

```

Which I got by

```
private List<String> truckcategories = new ArrayList<String>();
for (int j=0; j<catvals.size(); j++){
      truckcategories.add(catvals.get(j).getCategory());
}

```

So after clicking on the above list(`truckcategories`) am setting up another integers of indexes of the specific list item so

```
fruit  //gets 0
, juice //gets 1

```

So my integers i have are

```
Integer[] selecteditems = [0,1....]//the selected items

```

So, now I want to know how to filter the old `List<TruckCategoriesModel> catvals = truckcatesq.getLocationTruckCategories("tryoone"));` per the `selecteditems` indexes.