четверг, 22 апреля 2010 г.

Collection setter

There is two major ways to write setters for collection-type members.
This example combines both of them.
public void setPhones(List<PhoneNumber> phones) throws Exception
{
this.phones = phones;
this.phones.clear();
this.phones.addAll(phones);
}