Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

generics Interface in java

/*In similar way, we can create generic interfaces in java. We can also have multiple type parameters as in Map interface. Again we can provide parameterized value to a parameterized type also, for example new HashMap<String, List<String>>(); is valid.*/
package java.lang;
import java.util.*;

public interface Comparable<T> {
    public int compareTo(T o);
}
Source by www.journaldev.com #
 
PREVIOUS NEXT
Tagged: #generics #Interface #java
ADD COMMENT
Topic
Name
9+3 =