Skip to main content
added 2 characters in body
Source Link
Grim
  • 2.2k
  • 12
  • 63
  • 139

It is not allowed because it would/could lead to runtime errors. What if the list already contained objects that are not of class Job?

You should either:

  1. Change jobMapper.fetchAll() to return List<Job>.

  2. Cast the object instead of the list, ie. Job job = (Job) jobs.get(0).

It is not allowed because it would/could lead to runtime errors. What if the list already contained objects that are not of class Job?

You should either:

  1. Change jobMapper.fetchAll() to return List<Job>.

  2. Cast the object instead of the list, ie. Job job = (Job) jobs.get(0).

It is not allowed because it would/could lead to runtime errors. What if the list already contained objects that are not of class Job?

You should either:

  1. Change jobMapper.fetchAll() to return List<Job>.

  2. Cast the object instead of the list, ie. Job job = (Job) jobs.get(0).

Source Link
Axel
  • 14.2k
  • 6
  • 55
  • 80

It is not allowed because it would/could lead to runtime errors. What if the list already contained objects that are not of class Job?

You should either:

  1. Change jobMapper.fetchAll() to return List<Job>.

  2. Cast the object instead of the list, ie. Job job = (Job) jobs.get(0).