Question: Analyze step by step the time complexity(BigOh) of your implementations on Q1 on the two methods containsAll( ), addAll(): @Override public default boolean containsAll(Collection c)

Analyze step by step the time complexity(BigOh) of your implementations on Q1 on the two methods containsAll( ), addAll():

@Override public default boolean containsAll(Collection c) { // Left as an exercise Iteratoriter=c.iterator(); while(iter.hasNext()){ if(!contains(iter.next())){ return false; } } return true; }

@Override public default boolean addAll(Collection c) { // Left as an exercise boolean flag=true; for (E element:c){ flag&=add(element); } return true; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!