All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.org.github.jamm.AlwaysEmptySet Maven / Gradle / Ivy

package org.github.jamm;

import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.Callable;

public class AlwaysEmptySet implements Set {
    public static final Set EMPTY_SET = new AlwaysEmptySet();

    private AlwaysEmptySet() {
    }

    public static  Set create() {
    	return Collections.emptySet();
    }

    public static  Callable> provider() {
        return new Callable>() {
            public Set call() throws Exception {
                return create();
            }
        };
    }

    public int size() {
        return 0;
    }

    public boolean isEmpty() {
        return true;
    }

    public boolean contains(Object o) {
        return false;
    }

    public Iterator iterator() {
        return Collections.emptySet().iterator();
    }

    public Object[] toArray() {
        return new Object[0];
    }

    public  K[] toArray(K[] a) {
        return (K[]) Collections.emptySet().toArray();
    }

    public boolean add(T t) {
        return false;
    }

    public boolean remove(Object o) {
        return false;
    }

    public boolean containsAll(Collection c) {
        return false;
    }

    public boolean addAll(Collection c) {
        return false;
    }

    public boolean retainAll(Collection c) {
        return false;
    }

    public boolean removeAll(Collection c) {
        return false;
    }

    public void clear() {
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy