I have to create a Merge method to merge together two lists (Array-Based Lists). My method works, but now I have to change my method to generics. This is my method without gener
Assuming you have declared <T extends Comparable<T> >
at the class level, remove it on the method:
class OrderedArrayList1<T extends Comparable<T> > {
public OrderedArrayList1<T> merge(OrderedArrayList1<T> list2) {
...
}
}
Otherwise, you're defining a different type variable which just happens to have the same name, hence the slightly cryptic "T cannot be converted to T" message.