• Post Reply Bookmark Topic Watch Topic
  • New Topic

AddAll in ArrayList  RSS feed

 
Prem Bhazee
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All.
I am trying to append two arraylist as shown below.
bappendList = alValue1.addAll(alvalue2);

The bappendList is returning true as long as alvalue2.size > 0 but when alvalue2 = 0.It is returning false. So the addall will fail when the arraylist to be appended is of size '0'. Can you confirm.

Thanks
Bhazee
 
Bridget Kennedy
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick check of the ArrayList API provides this description of the addAll return value:

Returns:
true if this list changed as a result of the call

You get false for a zero-length add because there is no change to the original.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
didn't get what you are actually trying to achieve, can you please make it simpler.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!