Clearing the model and getting the selected indices are two separate things. It's not the job of the list model to track selection, for starters: that's the job of the ListSelectionModel, although there are convenience methods (like getSelectedIndex()) in JList.
So, to clear the model, either the model has such a method (ex: DefaultListModel does) or you create a new empty model and list.setModel(newModel).
To get the selected index(es), call the appropriate JList method (before you clear the data).