Beginner |
 |
Joined: Wed Nov 26, 2003 9:04 am Posts: 23
|
I'm having trouble tracking down the relevant documentation that explains the best way of going about having add methods to add a new item to a collection.
public Set getFoos() {
return foos;
}
public void setFoos(Set foos) {
this.foos = foos;
}
public void addFoo(Foo foo) {
this.foos.add(foo);
}
Now i get java.lang.UnsupportedOperationException when trying this. I'm in the process of trying out list rather than Set. But if anyone has any words of wisdom i'd appeciate any input you might have on the best way of going about this.
Am I besting using List, Set or Collection? I assume that using the static Collections.EMPTY_LIST and such like are bad news as they're imutable .
I assume there's some documentation on this could someone point me to it?
Mark
|
|