-
-
Save uncoded-ro/3edb9f0b477e8ac4f1467b0ad0323138 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ro.virtualcampus.app; | |
import java.util.Iterator; | |
import ro.virtualcampus.person.Student; | |
import ro.virtualcampus.unit.Facultate; | |
import ro.virtualcampus.set.CatalogSet; | |
public class AppSet { | |
public static void main(String[] args) { | |
Facultate etti = new Facultate("ETTI", "Vasile Parvan nr. 2"); | |
CatalogSet tst3 = new CatalogSet("3 TST"); | |
CatalogSet ea3 = new CatalogSet("3 EA"); | |
Student s1; | |
tst3.getStudenti().add(s1 = new Student("Irina Popescu", 22, etti, 3)); | |
tst3.getStudenti().add(new Student("Vlad Bucur", 23, etti, 3)); | |
ea3.getStudenti().add(new Student("Mihai Voda", 25, etti, 4)); | |
ea3.getStudenti().add(new Student("Bogdan Cornu", 24, etti, 4)); | |
tst3.transferStudenti(ea3.getStudenti()); | |
ea3.getStudenti().clear(); | |
tst3.afisareStudenti(); | |
if (tst3.getStudenti().remove(s1)) | |
System.out.println("studentul " + s1.getNume() + " a fost exmatriculat"); | |
else | |
System.out.println("studentul " + s1.getNume() + " nu poate fi exmatriculat"); | |
System.out.println("parcurgere studenti folosind for-each"); | |
for (Student student : tst3.getStudenti()) | |
System.out.println(student); | |
System.out.println("parcurgere studenti folosind iterator"); | |
Iterator<Student> i = tst3.getStudenti().iterator(); | |
while (i.hasNext()) | |
System.out.println(i.next()); | |
System.out.println("parcurgere studenti de la nivelul tabloului"); | |
Object[] studenti = tst3.getStudenti().toArray(); | |
for (Object student : studenti) | |
System.out.println(student); | |
if (!tst3.getStudenti().isEmpty()) | |
System.out.println("nu se recomanda desfintarea anului de studiu " + | |
tst3.getAnStudiu()); | |
tst3.getStudenti().clear(); | |
tst3.afisareStudenti(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment