Returning an anonymous class that uses a final primitive. How does it work?
- by Tim P
Hi,
I was wondering if someone could explain how the following code works:
public interface Result {
public int getCount();
public List<Thing> getThings();
}
class SomeClass {
...
public Result getThingResult() {
final List<Thing> things = .. populated from something.
final int count = 5;
return new Result {
…