This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Collections Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Collections Framework" Watch "Collections Framework" New topic
Author

Collections Framework

Marcelo Ortega
Ranch Hand

Joined: May 31, 2005
Posts: 519

In Khalid's last chapter (Collections), when he talks about OPTIONAL basic operations, what exactly does he mean?

i.e
boolean add(Object obj) //said to be optional
boolean remove(Object obj) //said to be optional


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD, SCEA/OCMJEA

Live life to an interface, not an implementation!
Wei-ju Wu
Ranch Hand

Joined: Feb 16, 2005
Posts: 147
Hi,

this means that these operations do not need to be fully implemented, if you have a look at the API documentation, an operation may throw UnsupportedOperationException if a concrete implementation of the List interface does not support the add(Object obj) method.

Wei-ju


"The UrlyBird catches the certificate. And he's gonna FlyByNight"<br /> <br />SCJP 1.2/5.0, SCJD, SCBCD, SCWCD, SCEA
Marcelo Ortega
Ranch Hand

Joined: May 31, 2005
Posts: 519

So basically, every concrete implementation inherits them, but some do not support them. Correct?
Wei-ju Wu
Ranch Hand

Joined: Feb 16, 2005
Posts: 147
Well, I would not say "inherit", but "implements" since they are interfaces. Correct is, that they do not necessarily have to be supported.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collections Framework