Duplicating words

  • 5
  • Locked
Let's write an echo program. It repeats everything it hears. More precisely, everything in a list of 10 strings. The echo program will actually accomplish this by creating a list of 10 words (we'll enter strings from the keyboard and add them to the list), and the doubleValues ​​method will basically duplicate the words in a specific way. Then we'll display the resulting echo. Piece of cake.
You can't complete this task, because you're not signed in.
Comments (13)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Xavi Martin
Level 22
25 October 2022, 07:24
Again, the statement does not clearly explain what to do. you have to be imaginative.
Level 13 , Alhambra, United States
26 October 2021, 02:58
do not forget to put list.size(); outside the for loop.
Level 15 , Old Town, United States
21 April 2021, 14:20
I guess it's always a good habit to just use .size(), rather than hard coding a number. :)
Richard Davies Java Developer
11 April 2021, 03:28
I had exactly what was required but it didn't want to pass testing. They require you to declare another ArrayList within the DoubleValues method. Seems a bit pointless when parsing in the ArrayList list. I even tried doing it this way before giving-up and looking at the answer. But still no-good.
Jurij Thmsn
Level 29 , Flensburg, Germany
12 January 2021, 14:01
Check for: "Be sure that the doubleValues method can work with lists of any length, not just 10." wasted one attempt on this ;)
Nickolas Johnson
Level 8 , St. Louis, United States of America
30 March 2020, 13:16
I really did not expect list.size() to change dynamically. I figured once the for statement is set, the size is set but apparently it re-evaluates the size every iteration. So, you can start out with a size of 10 and it increases each time the for loop iterates if you're adding to the list.
Level 41
27 October 2020, 10:09
Someone did not read carefully about ArrayList when Ellie taught it! haha! :D
Miha Čelešnik
Level 9 , Ilirska Bistrica, Slovenia
20 November 2019, 13:13
There is no need for method doubleValues to have return value, just use reference to original list and compute index instead of making whole new list.
Level 10 , Sydney, Australia
6 November 2019, 03:27
getting correct output but validation fails.Please help.
public static ArrayList<String> doubleValues(ArrayList<String> list) {
        //write your code here
        for(int i = 0;i< 20;i++)
Level 41
6 November 2019, 06:51
You have received this recommendation: "Be sure that the doubleValues method can work with lists of any length, not just 10."
Level 10 , Delhi, India
7 July 2019, 07:54
Can someone tell why is it showing "cannot resolve symbol list"?
Level 41
8 July 2019, 05:42
Declare a string list variable and immediately initialize it. Have you done it before line 16?
Level 15 , Providence, United States
22 June 2020, 01:19
I have an issue with "Declare a string list variable and immediately initialize it". please , I declared the variable but its not passing please help ...