mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
introduce variable inside lambda: do not step out of lambda block
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ExtractVariableSample {
|
||||
interface I {
|
||||
void foo(String s);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Collection<String> strings = new ArrayList<>();
|
||||
I i = (s) -> { System.out.println(<selection>s.hashCode()</selection>); };
|
||||
|
||||
for (String s : strings) {
|
||||
System.out.println(s.hashCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user