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

net.dongliu.commons.collection.EmptyRange Maven / Gradle / Ivy

There is a newer version: 12.0.2
Show newest version
package net.dongliu.commons.collection;

import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Stream;

/**
 * Empty range impl
 *
 * @author Liu Dong
 */
class EmptyRange implements Range {
    static final EmptyRange instance = new EmptyRange();

    private EmptyRange() {
    }

    @Override
    public Range reverse() {
        return this;
    }

    @Override
    public Range endClosed(boolean endClosed) {
        return this;
    }

    @Override
    public Range step(int step) {
        return this;
    }

    @Override
    public boolean contains(Object value) {
        return false;
    }

    @Override
    public long count() {
        return 0;
    }

    @Override
    public List toList() {
        return Lists.of();
    }

    @Override
    public Stream stream() {
        return Stream.empty();
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy