ArrayList
is an implementation of List
interface.
So all ArrayList
instances are List
instances but all List
instances are not necessarily ArrayList
.
So when you call this method :
public static <T> List<T> inRange(List<T> list, int index, int range) {
you cannot assign its result to an ArrayList
as you are doing :
ArrayList<View> inRange = Helper.inRange(...);
Go on to program by interface and use List
in both sides :
List<View> inRange = Helper.inRange(...);