Print a List of Objects in Java

0

When doing a filter of courses belonging to a given shift, the correct one would be to make a foreach by traversing an object, but when doing so it gives an error ';' expected , I did not quite understand why he gave it and when he added the ; error it too ...

@RequestMapping("/filtrarCursos/{idTurno}/{idTipoCurso}")
public String filtrarCursos(@PathVariable("idTurno") Long idTurno, @PathVariable("idTipoCurso") String idTipoCurso) {
    try {

        List<CursoTurno> cursoId = cursoTurnoRepository.findByTurnoId(idTurno);
        for ( c : cursoId ) {

        }

        System.err.print( "\n--- kingSizeCursos: "+cursoId.size());
        System.err.print( "\n--- idTurno: "+idTurno);
        System.err.print( "\n--- idTipoCurso: "+idTipoCurso);
    } catch (Exception e) {
        mensagem = mensagemErro(e.getMessage());
    }

    return "";
}
    
asked by anonymous 23.03.2017 / 13:03

1 answer

2

You need to "type" foreach :

List<CursoTurno> cursoId = cursoTurnoRepository.findByTurnoId(idTurno);
for(CursoTurno c : cursoId) {

}
    
23.03.2017 / 14:07