Hi,
I have the following code:
private static LinkedList InitListA() { LinkedList ListA = new LinkedList(); String Temp = null; int counter, buffer = 0; for (counter = 0; counter < MAX; counter++) { System.out.println("Enter Some Integer Values For List 'A':"); BufferedReader InputStream = new BufferedReader(new InputStreamReader(System.in)); try { Temp = InputStream.readLine().toString(); buffer = Integer.parseInt(Temp); ListA.add(new Integer(buffer)); }} catch (IOException e) { e.printStackTrace(); } } return ListA; }
I want InitListA() to terminate when <ENTER> is pressed with no strings keyed in.
How do I do it ?