sravan nagiri
sravan nagiri

Reputation: 95

How to remove the error in eclipse juno when using lambda expressions?

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

Answers (2)

greg-449
greg-449

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

Saravana
Saravana

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

Related Questions