Type Inference in JAVA
Many developers think that type inference is introduced in java in JDK 10 (March, 2018) release but since JDK 5 java has Type Inference mechanism. The Local type Inference is presented in JDK 10. First of all , What is Type Inference? Type inference refers to the automatic detection of the datatype of a variable, done generally at the compiler time. Example of type inference, JDK 5, If Type Inference is not applied by the compiler then we have to cast the element into specific type.Like in example, List<String> names = new ArrayList<String>(); names.<String>add("Yash"); names.<String>add("Parikh"); System.out.println(names); But,We don't need to cast because of Type Inference. List<String> names = new ArrayList<String>(); names.add("Yash"); names.add("Parikh"); System.out.println(names); After that In JDK 7 , Diamond Operator bro...