Extra array utilities
@@ -147,6 +147,10 @@ public class Array<T> implements Iterable<T>{
}
}
+ public boolean contains(Predicate<T> predicate){
+ return find(predicate) != null;
+ }
+
public T find(Predicate<T> predicate){
for(int i = 0; i < size; i++){
if(predicate.test(items[i])){
@@ -383,6 +387,10 @@ public class Array<T> implements Iterable<T>{
size -= count;
}
+ public boolean removeAll(Array<? extends T> array){
+ return removeAll(array, false);
+ }
+
/**
* Removes from this array all of elements contained in the specified array.
* @param identity True to use ==, false to use .equals().
