i have two lists one represents students other represents groups. so I have list of 200 students and I have to give them one of 10 created group. so I want to get list of 200 students with group
Name1 Surname1 group1
Name2 Surname2 group2
Name3 Surname3 group3
Name4 Surname4 group3
Name5 Surname5 group8
Name6 Surname6 group5
Name7 Surname7 group5
Name8 Surname8 group8
my code:
Random random = new Random();
List<Integer> groupID = IntStream.range(0, 10).mapToObj(i -> random.nextInt(9999))
.collect(Collectors.toList());
Faker names = new Faker();
List<String> generatedNames = IntStream.range(0, 200).mapToObj(i -> names.name().firstName())
.collect(Collectors.toList());
my sql tables:
CREATE TABLE groups(
group_id INTEGER,
group_name VARCHAR(50),
UNIQUE (group_id)
);
DROP TABLE IF EXISTS students CASCADE;
CREATE TABLE students(
student_id INTEGER NOT NULL,
group_id INTEGER,
first_name VARCHAR,
last_name VARCHAR,
UNIQUE(student_id)
);
Aucun commentaire:
Enregistrer un commentaire