fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.stream.Stream;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. class Girl {
  14. String name;
  15.  
  16. public Girl(String name) {
  17. this.name = name;
  18. }
  19.  
  20. @Override
  21. public String toString() {
  22. return name;
  23. }
  24. }
  25.  
  26. Girl[] glist = new Girl[] { new Girl("島崎遥香"), new Girl("指原莉乃"), new Girl("柏木由紀"), new Girl("山本彩"),
  27. new Girl("渡辺麻友"), new Girl("小嶋陽菜"), new Girl("宮脇咲良"), new Girl("松井珠理奈"), new Girl("横山由依"),
  28. new Girl("兒玉遥"), new Girl("入山杏奈"), new Girl("加藤玲奈"), new Girl("向井地見音"), new Girl("岡田奈々"),
  29. new Girl("小嶋真子"), new Girl("木崎ゆりあ"), new Girl("高橋朱里"), new Girl("川本紗矢"), new Girl("込山榛香"),
  30. new Girl("松岡はな"), new Girl("小栗有以"), new Girl("中井りか"), };
  31.  
  32. Stream.of(glist).filter(x -> x.name.startsWith("小")).forEach(System.out::println);
  33. }
  34. }
Success #stdin #stdout 0.08s 711168KB
stdin
Standard input is empty
stdout
小嶋陽菜
小嶋真子
小栗有以