soot.jimple.infoflow.collect.BlackHoleCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of soot-infoflow Show documentation
Show all versions of soot-infoflow Show documentation
Soot extending data flow tracking components for Java
package soot.jimple.infoflow.collect;
import java.util.Collection;
import java.util.Iterator;
/**
* This collection does nothing. You can add elements to it, but they won't be
* stored. This collection is useful if you have to supply a collection to some
* API method, but you don't really care about what gets added to the collection.
*
* @author Steven Arzt
*
* @param The type of elements in the collection
*/
public class BlackHoleCollection implements Collection {
@Override
public int size() {
return 0;
}
@Override
public boolean isEmpty() {
return true;
}
@Override
public boolean contains(Object o) {
return false;
}
@Override
public Iterator iterator() {
return new Iterator() {
@Override
public boolean hasNext() {
return false;
}
@Override
public E next() {
return null;
}
@Override
public void remove() {
}
};
}
@Override
public Object[] toArray() {
return new Object[0];
}
@Override
public T[] toArray(T[] a) {
return a;
}
@Override
public boolean add(E e) {
return true;
}
@Override
public boolean remove(Object o) {
return false;
}
@Override
public boolean containsAll(Collection> c) {
return false;
}
@Override
public boolean addAll(Collection extends E> c) {
return true;
}
@Override
public boolean removeAll(Collection> c) {
return false;
}
@Override
public boolean retainAll(Collection> c) {
return false;
}
@Override
public void clear() {
}
}