Java Extends vs Super

Dec 1, 2021 | - views

<T> void copy(List<? extends T> src, List<? super T> dest) {
    if (src == null || dest == null || src.size() != dest.size()){
        throw new IllegalArgumentException();
    }

    for (int i = 0; i < src.size(); i++) {
        dest.set(i, src.get(i));
    }
}

PECS : Producer Extends, Consumer Super