Java 7 Type Inference: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 6: Line 6:


The type can be inferred from context with generic inference using the diamond operator (<>).
The type can be inferred from context with generic inference using the diamond operator (<>).
<syntaxhighlight lang='java'>
List<String> listOfStrings = new ArrayList<>();
List<Integer> listOfIntegers = new ArrayList<>();
</syntaxhighlight>


=TODO=
=TODO=

Revision as of 01:27, 24 March 2018

Internal

Overview

The type can be inferred from context with generic inference using the diamond operator (<>).

 List<String> listOfStrings = new ArrayList<>();
 List<Integer> listOfIntegers = new ArrayList<>();

TODO

  • Type inference used by lambda expression, which can omit the explicit type declaration in the formal parameter list.