My code is as below:
private <A extends AbstractDocument> List<A> reorderDocuments(List<A> docs)
{
List<A> newdoclist = new ArrayList<A>();
for (A o : docs) {
if(//some condition) {
//TODO::Generic type
List<A> tempDocs = new ArrayList<A>();
tempDocs.add( o );
tempDocs.addAll(o.getAlikeDocuments());
//sort method called
}
return newdoclist;
}
have changed the start tag for the type with the function o.getAlikeDocuments()
returns List of type Abstract document, but this method is still giving me error on line tempDocs.addAll(o.getAlikeDocuments());
saying The method addAll(Collection<? extends A>)
in the type List is not applicable for the arguments (List<AbstractDocument>)
.
Appreciate the help in advance.
Thanks
Vaibhav