List<Direction> directionsWithNullValues = Lists.newArrayList(null, null, null);
Ouch! Compiler warning: unchecked generic array creation of type E[] for varargs parameter
What's going on here? An array can be created, but Java is confused regarding the type. Just cannot deduce it.
The solution is simple (although awkward):
List<Direction> directionsWithNullValues = Lists.newArrayList((Direction)null, null, null);
No comments:
Post a Comment