Guest User

Untitled

a guest
May 25th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. List<String> fruits = Arrays.asList("Orange", "Apple", "Plum", "Medlar", "Durian", "Strawberry");
  2.  
  3. List<String> result = new ArrayList<>();
  4. for (String fruit : fruits) {
  5. if (fruit.endsWith("e")) {
  6. result.add(fruit);
  7. } else {
  8. break;
  9. }
  10. }
  11. System.out.println(result);
Add Comment
Please, Sign In to add comment