I have a method to remove an object from the list, this is used to create a listView so the object is removed using the index of the listview item selected. But I want the method to work for several types of objects i.e., I have more than one listview.
public void removeFromList(ListView<Label> listView, ArrayList<objects?> arrayList){
        int minus = listView.getSelectionModel().getSelectedIndex();
        arrayList.remove(minus);
        listView.getItems().remove(minus);
}
 
     
    