-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Many-to-many mutable collection
PostPosted: Fri Jun 18, 2004 6:21 am 
Beginner
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.