java - Java7 Type inference for generic instance creation? -
how can use java 7 type inference generic instance creation feature ? benefits use new style?
this known diamond operator. saves having write generic type arguments on instantiation of generic type. type arguments of instantiated generic type inferred type arguments present on declaration.
arraylist<string> list = new arraylist<>();
instead of:
arraylist<string> list = new arraylist<string>();
Comments
Post a Comment