addAll
takes as its parameter a Collection
and then adds all the elements of that collection to itself. In your case, you're trying to give it something that is not a Collection
, so the compiler is trying to make it work by casting the argument to the correct type. In this particular case, the correct type is a collection of some object which extends EmpApp
, i.e., Collection<? extends EmpApp>
.
Judging from the name of your variable, employee
probably isn't a collection, so you need to revisit the API for whatever collection empobj
is and find out how you can add a single element to it (likely add
).