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

personthecat.catlib.data.EmptyRange Maven / Gradle / Ivy

Go to download

Utilities for serialization, commands, noise generation, IO, and some new data types.

The newest version!
package personthecat.catlib.data;

import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.Iterator;
import java.util.Random;

public class EmptyRange extends Range {

    private static final EmptyRange INSTANCE = new EmptyRange();

    private EmptyRange() {
        super(0);
    }

    public static EmptyRange get() {
        return INSTANCE;
    }

    @Override
    public boolean contains(int num) {
        return false;
    }

    @Override
    public int rand(Random rand) {
        return 0;
    }

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

    @Override
    public boolean isEmpty() {
        return true;
    }

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

    @Override
    public String toString() {
        return "Range[empty]";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy