I got a strange problem about a local variable and a lambdafunction that seems not to be able to deal with it. I keep getting the error-message *"local variable acc defined in an enclosing scope must be final or effectively final"*

My code looks like this: 

```
Accumulator acc = new Accumulator(0, 0);
stream.reduce(0, (sum, value) -> {
    acc = new Accumulator(sum + value, acc.getB()+1);
    return sum + value;
});

```

So as you can see, I am trying to reduce a stream of integers and keep 2 values instead of just the one from the reducing-process. I am trying to save those values in the little helper class `Accumulator`, which got a `final int a` and a `final int b` to store those. However, it seems like `stream.reduce` can't reach `acc`. 

On other parts of my program, including other lambda-functions, similar code-structures work fine (declaring local variables and changing them inside the lambda-function), so I don't know what to do.

Example (the `stream` is initialized of course):

```
ArrayList<StudentRecord> studentList = new ArrayList<StudentRecord>();
stream.forEach(student -> {
    studentList.add(student);
});

```

Help would be appreciated,
Regards