Create generic function with Wildcard - Java Object Oriented Design

Java examples for Object Oriented Design:Generic Method

Description

Create generic function with Wildcard

Demo Code

import java.util.List;

public class WildcardFixed {

    void foo(List<?> i) {
        fooHelper(i);//from  w ww. java 2 s. co m
    }

    private <T> void fooHelper(List<T> l) {
        l.set(0, l.get(0));
    }

}

Related Tutorials