• 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: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,
Can anyone help me out with this ?
Which of these methods from the Collection interface return the value true if the collection object was actually modified by the call?
a. add()
b. retainAll()
c. containsAll()
d. contains()
e. remove()

Thx in advance.
Aruna
 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
answer: add(), retain(), retainAll(), and remove()
although contains() and containsAll() also return a boolean value, the point to remember here is that the question asks for methods that return true AFTER modification
HTH
chetan
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add() - Returns true if this collection changed as a result of the call.
retainAll() - Return true if this collection changed as a result of the call
contains() - Returns true if this collection contains the specified element
containsAll() - Returns true if this collection contains all of the elements in the specified collection.
remove() - Returns true if this collection changed as a result of the call
Ada
 
Ada Wang
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer should be ABE.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I agree with wang.The answer is a,b,e
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a and e
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic