M
M
Mikhail2017-06-05 22:16:21
Java
Mikhail, 2017-06-05 22:16:21

How to pair all input strings Java Scanner?

Actually, first I need to parse all the proxy servers entered into the console, and then scatter them over the server-port lists. However, it doesn't go beyond the first while loop. Once upon a time I solved this problem, I understand that it is trivial, but I forgot how. Help please :)

while (sc.hasNextLine()){
            Proxy_list.add(proxy_place, sc.nextLine());
            proxy_place++;
        }

        for (int i = 0; i < Proxy_list.size()-1; i++){
            String[] ipANDport = Proxy_list.get(i).split(":");
            Proxy_IP.add(i,ipANDport[0]);
            Proxy_Port.add(i,ipANDport[1]);
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Alexandrov, 2017-06-05
@jamakasi666

And actually where does it come out of the while loop? :) hasNextLine() will always return true.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question