in the task I have to read a list of names stored in a column in a remote file. I have to read them from the resource identified by the URL (I have already done this) and then I am using a set to draw 15 names without repeat (random) names. I have no idea how to do it, I was looking at google, but unfortunately I did not find the answer to my problem. I am asking for help and guidance
import java.util.HashSet;
import java.util.Set;
import java.net.*;
import java.io.*;
public class Race {
public static void main(String[] args) throws Exception {
URL oracle = new URL("http://szgrabowski.kis.p.lodz.pl/zpo17/nazwiska.txt");
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
Set<String> nameList = new HashSet<String>();
nameList.add(inputLine);
in.close();
}
}