-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetComputerScientist.java
40 lines (31 loc) · 969 Bytes
/
GetComputerScientist.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.concurrent.Exchanger;
/**
* Created by Francis on 6/06/2016.
*/
public class GetComputerScientist {
public class ComputerScientist {
public String name;
public String twitterHandle;
public ComputerScientist(String n, String t) {
name = n;
twitterHandle = t;
}
}
public ArrayList<ComputerScientist> getComputerScientists() {
ArrayList<ComputerScientist> scientists = new ArrayList<>();
try {
Scanner sc = new Scanner(new File("ComputerScientists.txt"));
while (sc.hasNext()) {
ComputerScientist cs = new ComputerScientist(sc.nextLine(), sc.nextLine());
scientists.add(cs);
}
} catch (IOException e) {
e.printStackTrace();
}
return scientists;
}
}