Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. package com.javarush.test.level07.lesson09.task04;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.InputStreamReader;
  5. import java.util.ArrayList;
  6.  
  7. /* Letters «r» and «l»
  8. 1. Create a list of words/strings, fill it with whatever you want.
  9. 2. The method fix() should:
  10. 2.1. delete all the words containing letter «r» from the list of strings
  11. 2.2. double all the words containing letter «l».
  12. 2.3. leave the word unchanged if it contains both letters «r» and «l».
  13. 2.4. don’t do anything with other words.
  14.  
  15. Example:
  16. rose
  17. willow
  18. lyre
  19. oak
  20.  
  21. Output data:
  22. willow
  23. willow
  24. lyre
  25. oak
  26. */
  27.  
  28. public class Solution
  29. {
  30. public static void main(String[] args) throws Exception
  31. {
  32. BufferedReader bis = new BufferedReader(new InputStreamReader(System.in));
  33.  
  34. ArrayList<String> list = new ArrayList<String>();
  35. list.add("rose"); //0
  36. list.add("lyre"); //1
  37. list.add("willow"); //2
  38. list = fix(list);
  39.  
  40. for (String s : list)
  41. {
  42. System.out.println(s);
  43. }
  44. }
  45.  
  46. public static ArrayList<String> fix(ArrayList<String> list)
  47. {
  48. //add your code here
  49. return null;
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement