import java.util.List; public class Lieu { String nom; Condition deposable; Condition depart; Condition fin; List personnes; List descriptions; List objets; List connaissances; public Lieu( String nom, Condition deposable, Condition depart, Condition fin, List personnes, List descriptions, List objets, List connaissances) { this.nom = nom; this.deposable = deposable; this.depart = depart; this.fin = fin; this.personnes = personnes; this.descriptions = descriptions; this.objets = objets; this.connaissances = connaissances; } @Override public String toString() { return nom; } public static Lieu search(List list, String name) { return list.stream().filter(o -> o.nom.equals(name)).findFirst() .orElseThrow(() -> new IllegalArgumentException("No data found")); } }