This commit is contained in:
2026-07-05 15:14:46 +03:30
parent 83746b88f6
commit 41979c1752
12 changed files with 142 additions and 156 deletions
+8 -34
View File
@@ -1,59 +1,33 @@
package dev.thread;
import dev.model.Student;
import java.util.ArrayList;
import java.util.List;
public class StudentLoader extends Thread {
// Assigned file lines
private final List<String> lines;
// Local student storage
private final ArrayList<Student> students = new ArrayList<>();
public StudentLoader(List<String> lines) {
this.lines = lines;
}
@Override
public void run() {
// TODO:
/*
Example line:
1001,Aryan,Computer Science,3.7
*/
for (String line : lines) {
String[] data = line.split(",");
if (data.length == 4) {
int id = Integer.parseInt(data[0].trim());
String name = data[1].trim();
String major = data[2].trim();
double gpa = Double.parseDouble(data[3].trim());
// TODO:
// split line
// TODO:
// read values
// TODO:
// create Student
// TODO:
// add to students list
students.add(new Student(id, name, major, gpa));
}
}
}
public ArrayList<Student> getStudents() {
return students;
}
}