This code is legal in Intellij Idea but illegal in eclipse
private static void gogo()
{
List<Double> l = cc(new ArrayList());
}
private static List<String> cc(List<Integer> coll)
{
return new ArrayList<>();
}
this is an obvious mistake but idea can compile the code without any error.
but in eclipse it's a compile error:
Multiple markers at this line
- Type mismatch: cannot convert from List<String> to List<Double>
- ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized
- Type safety: The expression of type ArrayList needs unchecked conversion to conform to List<Integer>
if the code is this
private static void gogo()
{
List<Double> l = cc(new ArrayList<>());
}
private static List<String> cc(List<Integer> coll)
{
return new ArrayList<>();
}
the intellij idea will tell me the code is error
Incompatible types.
- Required: List<java.lang.Double>
- Found: List<java.lang.String>
the difference of two code is the <> after ArrayList.