1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public class Affaire {
static private int compteurAffaire; //Compteur Nbre d'Affaire en cours // attention au passage à ce genre de chose en multithread, préférez un AtomicInteger
String affaire; //Nom de l'Affaire
List<Contact> contacts = new ArrayList();
public Affaire(String affaire) {
compteurAffaire++;
this.affaire = affaire;
}
public List<Contact> getContacts() {
return Collections.unmodifiableList(contacts);
}
public <T> List<T> getContactInformationList(Function<Contact, T> function) {
return contacts.stream().map(c->function.apply(c)).collect(Collectors.toList());
}
} |