Created
May 23, 2015 17:32
-
-
Save Acarus/5445ff8cb9a2fb151c00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean removeAll(Collection<?> c) { | |
for(Object item: c) { | |
int index = indexOf(item); | |
while(index >= 0) { | |
remove(index); | |
index = indexOf(item); | |
} | |
} | |
return true; | |
} | |
@Override | |
public boolean retainAll(Collection<?> c) { | |
Object[] arr = toArray(); | |
for(Object item: arr) { | |
if(!c.contains(item)) { | |
int index = indexOf(item); | |
while(index >= 0) { | |
remove(index); | |
index = indexOf(item); | |
} | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment