fork(2) download
  1. import java.util.*;
  2. import java.util.stream.Collectors;
  3. import java.lang.*;
  4. import java.io.*;
  5. import java.util.regex.*;
  6.  
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. String s = "abcd erhjr @@_dhsdj_@@ dshdgj andaj edwyhu @@_dgayw_@@ nssd.";
  12. List<String> res = Arrays.stream(s.split("\\s+"))
  13. .filter(i -> i.startsWith("@@_") && i.endsWith("_@@"))
  14. .collect(Collectors.toList());
  15. System.out.println(res);
  16. }
  17. }
Success #stdin #stdout 0.14s 2184192KB
stdin
Standard input is empty
stdout
[@@_dhsdj_@@, @@_dgayw_@@]