java - How to use multiple upper bounds in generics -
i have interface foo has generic type -
public interface foo<t> { boolean apply(t t); }
having class bar implements interface want generic type of bar should collection of type interface , b, below definition giving compiler error -
public class bar implements foo<collection<? extends & b>>{ @override public boolean apply(collection<? extends & b> collect){ ... } }
can suggest correct way achieve this?
i can use multiple bounds @ method level only?
wouldn't work?
public class bar<t extends & b> implements foo<collection<t>>{ @override public boolean apply(collection<t> collect){ ... } }
Comments
Post a Comment