int () { // We can't just use model.indexOf(myRule) because there is a possible case that the model contain equal // rules (rule1.equals(rule2) == true). That's why we have a helper method for search by reference identity. ArrangementMatchingRulesModel model = myList.getModel(); for (int i = 0, max = model.getSize(); i < max; i++) { if (model.getElementAt(i) == myModelValue) { return i; } } return -1; }