Reputation: 95
I am using eclipse juno for my project. I am trying to do convert from String array to integer array. For this expressions, I am using below code.
String[] c1 = {"5","4","2","1"}; int[] c = Arrays.stream(c1).mapToInt( Integer::parseInt()).toArray();
how to remove this error in eclipse. please can any one help me please.
Upvotes: 0
Views: 3638
Reputation: 111216
Eclipse Juno does not support lambdas (or Java 8 in general). You need to be using Eclipse Mars (or Luna) for full Java 8 support.
Upvotes: 1
Reputation: 12817
change it to
int[] c = Arrays.stream(c1).mapToInt(Integer::parseInt).toArray();
no need of round brackets (parenthese) for method references Integer::parseInt
is enough
Upvotes: 1