-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterviewPicker.java
More file actions
45 lines (32 loc) · 1.28 KB
/
InterviewPicker.java
File metadata and controls
45 lines (32 loc) · 1.28 KB
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
41
42
43
44
45
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class InterviewPicker {
public static void main(String[] args) {
// Create a string array of interviewees
String[] interviewees = {
"Asher Cartegena",
"Mason Fiorini",
"Lauren Gradford",
"Imani Hollie",
"Stefan Howell",
"Elikia Kilandi",
"Wilsarte Merat"
};
// Create an arraylist derived from the array
List<String> studentList = Arrays.asList(interviewees);
// Use the static method shuffle to randomize the list
Collections.shuffle(studentList);
// display the randomized list using a traditional for loop
for(int i=0; i < interviewees.length ; i++){
System.out.println((i+1) + ". " + interviewees[i]);
}
// Display the randomized array using a Stream object
/*
IntStream.range(0, interviewees.length)
.mapToObj(i -> (i+1) + ". " + interviewees[i])
.forEach(System.out::println);
*/
//Arrays.stream(interviewees).forEach(System.out::println);
}
}