package bibliotheek;
import java.util.ArrayList;
import bibliotheek.Boek;
public class Bibliotheek {
ArrayList<boek> boekenlijst = new ArrayList</boek><boek>();
public Bibliotheek(){
}
public ArrayList<string> geefTitels(){
ArrayList</string><string> titels = new ArrayList</string><string>();
for (Boek b: boekenlijst){
titels.add(b.getTitel());
}
return titels;
}
public String geefAuteur(String titel){
String auteur = null;
for (Boek b: boekenlijst){
if (b.getTitel().equals(titel)) {
auteur = b.getAuteur();
}
}
return auteur;
}
public void voegBoekToe(String titel, String auteur){
Boek nieuwBoek = new Boek(titel, auteur);
boekenlijst.add(nieuwBoek);
}
}
</string></boek>
Code snippets, Unix, Programming.