What does "optional" mean in this context?
public interface Collection<E> extends Iterable<E>
{
// Basic operations
int size();
boolean isEmpty();
boolean contains(Object element);
// optional
The last line comment "//optional": what does it mean? I tried to implement a Collection by implementing it public class Col-implementation implements Collection and it's not optional at all.
I need to implement all the methods, even the ones commented as "optional". I am clearly not getting what they mean by "optional". Any insight about that?
You must provide an implementation, but that implementation can throw an UnsupportedOperationException.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With