how?
package com.codegym.task.task07.task0717;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Duplicating words
1. Read 10 words from the keyboard and add them to a list of strings.
2. The doubleValues method should duplicate words like this:
alpha, beta, gamma, -> alpha, alpha, beta, beta, gamma, gamma.
3. Display the result, each value on a new line.
*/
public class Solution {
public static void main(String[] args) throws Exception {
// Read strings from the console and declare an ArrayList here
ArrayList<String>list=new ArrayList<String>();
for(int i=0;i<10;i++){
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
list.add(reader.readLine());
}
ArrayList<String> result = doubleValues(list);
// Display result
for(int i=0;i<list.size();i++) System.out.println(list.get(i));
}
public static ArrayList<String> doubleValues(ArrayList<String> list) {
//write your code here
for(int i = 0;i<list.size();i++){
list.add(list.get(i));
}
return list;
}
}