My code just seems to accept input strings forever, and I cannot for the life of me figure out why. Can someone help?
package com.codegym.task.task07.task0717;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Duplicating words
*/
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>();
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 10; i++) {
list.add(read.readLine());
}
ArrayList<String> result = doubleValues(list);
// Display result
System.out.println(result);
}
public static ArrayList<String> doubleValues(ArrayList<String> list) {
//write your code here
ArrayList<String> oper = list;
for (int i = 0; i < list.size(); i++) {
oper.add(i, list.get(i));
}
return oper;
}
}