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.  [ 8 posts ] 
Author Message
 Post subject: Generics and Iesi
PostPosted: Fri Dec 15, 2006 10:22 am 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
Hi everyone,


I'm now using the latest beta version that support generics..

And I would like to understand the difference between the bag, set, list and map ..

and what type (generic?) should I use in each case. I guess that's what Iesi is all about? Cuz up until now, I used List for every collection and used IList as my type and ArrayList when instanciating..

That would be really appreciated.
Thanks


Top
 Profile  
 
 Post subject: Re: Generics and Iesi
PostPosted: Fri Dec 15, 2006 11:02 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
martbl wrote:
I'm now using the latest beta version that support generics..

And I would like to understand the difference between the bag, set, list and map ..

and what type (generic?) should I use in each case. I guess that's what Iesi is all about? Cuz up until now, I used List for every collection and used IList as my type and ArrayList when instanciating..


The Iesi is used only for <set>'s (bot generic and non-generic). For non-set collections, use generic versions of standard collections.

Gert

_________________
If a reply helps You, rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 11:12 am 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
And can you tell me the difference between bag, set, list and map ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 11:56 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
martbl wrote:
And can you tell me the difference between bag, set, list and map ?


<set> can not contain duplicate entries.
<bag> can have duplicates.
<list> is as bag, but the items are at fixed positions, determined by index element. If some indexes are missing, list will contains nulls at those positions.
<map> should be equivalent to dictionary. (key-value pair)

Gert

_________________
If a reply helps You, rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 11:59 am 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
nice.

and in a list, is the object aware of its position in the list?

THanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 12:01 pm 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
martbl wrote:
and in a list, is the object aware of its position in the list?


I'm bnot sure - I have not found a place for <list> in my code yet :D

Gert

_________________
If a reply helps You, rate it!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 12:04 pm 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
So most of the time it would be a Set or a Bag .. ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 7:56 pm 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
A <list> is useful when you need to include specific criteria to an element within a list in an HQL query. Now, I think you can do that with the elements keyword in HQL but I am not sure how yet. I 'spect Gert can tho :)
So if you need to reference an element in a collection by its position you reference the index.

_________________
If this helped...please remember to rate it!


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

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.