• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

collections

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are any body good in collections,can u help me.
Given two collection objects referenced by col1 and col2, which of these statements are true? (multiple answers)
a) the operation c1.retainALL(col2) does not modify the col1 object
b) the operation c1.removeAll(col2) will not modify the col2 object
c)the operation c1.addAll(col2) will return collection object
containing elements from both col1 and col2
d) the operation c1.containsAll(col2) will not modify the col1 object

please tell me correct answers. i am not sure of collections.
thank u
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by gouru:
are any body good in collections,can u help me.
Given two collection objects referenced by col1 and col2, which of these statements are true? (multiple answers)
a) the operation c1.retainALL(col2) does not modify the col1 object
b) the operation c1.removeAll(col2) will not modify the col2 object
c)the operation c1.addAll(col2) will return collection object
containing elements from both col1 and col2
d) the operation c1.containsAll(col2) will not modify the col1 object

please tell me correct answers. i am not sure of collections.
thank u


a - false - c1 is modified to only have the elements that are common in both.

b - true - col2 is never modified only used as the comparasion to c1 note: c1 is modified to only have the elements that are not in col2.
c - false - the return of the method is boolean, c1 is modified to contain all the elements of c1 and c2
d - true - containsAll returns a boolean result if c1 contains all the elements in c2 but, doesn't modify the c1 object.


[This message has been edited by Carl Trusiak (edited June 21, 2000).]
 
No, tomorrow we rule the world! With this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic