Aviv Cohn
Aviv Cohn

Reputation: 17193

Why is this generic method signature invalid?

static void stuff(Thing thing, Iterable<T extends Something> stuff){
    ...
}

This doesn't compile, Eclipse puts a red line under extends. However if I change T to ?, it works. Why?

Upvotes: 0

Views: 66

Answers (1)

Dici
Dici

Reputation: 25950

Try :

static <T  extends Something> void stuff(Thing thing, Iterable<T> stuff){
    //... 
}

Upvotes: 4

Related Questions