Guest User

Untitled

a guest
Dec 16th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import java.util.Set;
  2. import java.util.TreeSet;
  3.  
  4. public class LineCharLimiter {
  5.  
  6. private final Set<Character> chars = new TreeSet<>();
  7.  
  8.  
  9. public LineCharLimiter(String chars){
  10. for(char ch : chars.toCharArray()){
  11. this.chars.add(ch);
  12. }
  13. }
  14.  
  15.  
  16. public String handle(String str){
  17. for(char ch : str.toCharArray()){
  18. if(!this.chars.contains(ch))
  19. return null;
  20. }
  21.  
  22. return str;
  23. }
  24. }
Add Comment
Please, Sign In to add comment