Created
July 31, 2011 16:10
-
-
Save kmizu/1116918 to your computer and use it in GitHub Desktop.
By using diamond operator, type inference is done correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class DiamondOperators { | |
public static void main(String[] args) { | |
Collection<? extends Number> collection = null; | |
List<? super String> list = new ArrayList<>(collection); | |
} | |
} |
Author
kmizu
commented
Jul 31, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment