I'm not saying it's the right wy to do a UI BTW. the predictae you pass in (or lambda, it compiles to the same thing) needs to know it's operating inside the main UI loop so it have a bunch of implied ...
You might know that Java passes by value, but it helps to understand why. Here's what happens when you pass mutable and immutable object references in Java. Many programming languages allow passing ...