java - Local variable log defined in an enclosing scope must be final or effectively final -


i'm new lambda , java8. i'm facing following error.

local variable log defined in enclosing scope must final or final

public javardd<string> modify(javardd<string> filteredrdd) {      filteredrdd.map(log -> {          placeholder.foreach(text -> {              //error comes here             log = log.replace(text, ",");          });          return log;      });      return null; } 

the message says problem is: variable log must final (that is: carry keyword final) or final (that is: assign value once outside of lambda).

otherwise, can't use variable within lambda statement. of course, conflicts usage of log. point is: can't write external within lambda ... have step , other ways whatever intend do.

in sense: believe compiler. , side node: instead of posting error message here; try first google (that called "prior research" , expected do).


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -