daily pastebin goal
56%
SHARE
TWEET

lambda

a guest Mar 22nd, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. import java.util.function.Predicate;
  3.  
  4. public class Ex1{
  5.  
  6.     public static void main(String[] args) {
  7.  
  8.         Set<Character> chars = new HashSet<>();
  9.         chars.add('a');
  10.         chars.add('b');
  11.         chars.add('c');
  12.         chars.add('d');
  13.         String line1 = "abcd";
  14.         String line2 = "qwer";
  15.  
  16.         Predicate<String> isIllegalString = s -> s.contains(!chars);
  17.  
  18.         System.out.println(isIllegalString.test(line1));
  19.         System.out.println(isIllegalString.test(line2));
  20.  
  21.     }
  22.  
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top