-->
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.  [ 4 posts ] 
Author Message
 Post subject: List = criteria.list() How to add 2 lists together?
PostPosted: Tue Mar 24, 2009 3:13 am 
Newbie

Joined: Tue Mar 10, 2009 10:48 pm
Posts: 18
Hi, I have the following lists.

List result1 = criteria1.list();
List result2 = criteria2.list();

List totalResult = result1.add(result2);

Error:
Type mismatch: cannot convert from boolean to List


How could I add two lists together??


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 24, 2009 4:32 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Code:
result1.addAll(result2);


Now, result1 contains the original result1 plus all entries in result2.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 24, 2009 10:15 pm 
Newbie

Joined: Tue Mar 10, 2009 10:48 pm
Posts: 18
Thank you for your kind reply.

Even I have changed to
List totalResult = result1.addAll(result2);


It is still giving me the error:
Type mismatch: Cannot convert from boolean to list.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 25, 2009 1:11 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
janiceileen wrote:
Thank you for your kind reply.

Even I have changed to
List totalResult = result1.addAll(result2);


It is still giving me the error:
Type mismatch: Cannot convert from boolean to list.



Hi,

the return of List.addAll() is boolean.

just result1.addAll(result2).

The result1 will contain all of the results


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.