/** * Determines if a given String is present in the list * * @param scan the String to look for in the list * @param list the list of values to examine * @return true if the list contains the String, false otherwise */ public boolean isContainedInList(String scan, JList list) { DefaultListModel listModel = (DefaultListModel) list.getModel(); return listModel.contains(scan); }