final CurricularCourse curricularCourse = (CurricularCourse) CollectionUtils.find( sourceExecutionCourse.getAssociatedCurricularCourses(), new Predicate() { public boolean evaluate(Object arg0) { CurricularCourse curricularCourse = (CurricularCourse) arg0; return (curricularCourseId == curricularCourse.getIdInternal()); } });
CurricularCourse curricularCourse = null; for (final CurricularCourse curricularCourseOther : sourceExecutionCourse.getAssociatedCurricularCoursesSet()) { if (curricularCourseOther.getIdInternal().equals(curricularCourseId)) { curricularCourse = curricularCourseOther; break; } }
    public void run(Integer sourceExecutionCourseId, final Integer curricularCourseId,            Integer destinationExecutionCourseId) throws ExcepcaoPersistencia {        final ExecutionCourse sourceExecutionCourse = rootDomainObject.readExecutionCourseByOID(sourceExecutionCourseId);        final ExecutionCourse destinationExecutionCourse = rootDomainObject.readExecutionCourseByOID(destinationExecutionCourseId);        final CurricularCourse curricularCourse = (CurricularCourse) CollectionUtils.find(                sourceExecutionCourse.getAssociatedCurricularCourses(), new Predicate() {                    public boolean evaluate(Object arg0) {                        CurricularCourse curricularCourse = (CurricularCourse) arg0;                        return (curricularCourseId == curricularCourse.getIdInternal());                    }                });        deleteShiftStudents(sourceExecutionCourse, curricularCourse);                Set<Integer> transferedStudents = new HashSet<Integer>();        transferAttends(destinationExecutionCourseId, sourceExecutionCourse, destinationExecutionCourse,                curricularCourse, transferedStudents);                sourceExecutionCourse.removeAssociatedCurricularCourses(curricularCourse);        destinationExecutionCourse.addAssociatedCurricularCourses(curricularCourse);    }