public Index findIndexByConstraint(ReferenceConstraint constraint) { Iterator it = this.elements.iterator(); while (it.hasNext()) { Object elem = it.next(); if (elem instanceof Index && ((Index) elem).getName().equals(constraint.getName())) { return (Index) elem; } } return null; }