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.
Duplicating words
- 5
Locked
Comments (13)
- Popular
- New
- Old
You must be signed in to leave a comment
Xavi MartinExpert
25 October 2022, 07:24
Again, the statement does not clearly explain what to do. you have to be imaginative.
0
Chloe
26 October 2021, 02:58
do not forget to put list.size(); outside the for loop.
+1
ImDevin
21 April 2021, 14:20
I guess it's always a good habit to just use .size(), rather than hard coding a number. :)
0
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.
0
Jurij Thmsn
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 ;)
0
Nickolas Johnson
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.
+3
Andrei
27 October 2020, 10:09
Someone did not read carefully about ArrayList when Ellie taught it! haha! :D
0
Miha Čelešnik
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.
0
Bhakti
6 November 2019, 03:27
getting correct output but validation fails.Please help.
0
Roman
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."
0
SUSHANT
7 July 2019, 07:54
Can someone tell why is it showing "cannot resolve symbol list"?
0
Roman
8 July 2019, 05:42
Declare a string list variable and immediately initialize it.
Have you done it before line 16?
0
Edddieg
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 ...
0