Skip to content

Instantly share code, notes, and snippets.

@isopov
Created February 1, 2017 08:44
Show Gist options
  • Save isopov/97639773b202663ad65075ae988e1f4d to your computer and use it in GitHub Desktop.
Save isopov/97639773b202663ad65075ae988e1f4d to your computer and use it in GitHub Desktop.
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import static java.util.Arrays.asList;
/**
* @author isopov
*/
public final class CollectInspectionTest {
private void foobar() {
final List<Callable<Boolean>> callables = new ArrayList<>();
final Set<String> ab = new HashSet<>(asList("a", "b"));
final List<String> list = asList("a", "b", "c");
for (String f : list) {
if (!ab.contains(f)) {
continue;
}
callables.add(() -> {
System.out.println(f);
return false;
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment