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

dev.marksman.collectionviews.EmptySet Maven / Gradle / Ivy

There is a newer version: 1.2.3
Show newest version
package dev.marksman.collectionviews;

import java.util.Iterator;

import static java.util.Collections.emptyIterator;

final class EmptySet extends ConcreteSet implements ImmutableSet, Primitive {
    private static final EmptySet INSTANCE = new EmptySet<>();

    @Override
    public int size() {
        return 0;
    }

    @Override
    public boolean contains(A element) {
        return false;
    }

    @Override
    public Iterator iterator() {
        return emptyIterator();
    }

    @SuppressWarnings("unchecked")
    static  EmptySet emptySet() {
        return (EmptySet) INSTANCE;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy