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

com.jfreeman.lazy.Constant Maven / Gradle / Ivy

Go to download

A library for type-safe, tractable lazy evaluation and late binding in Java.

There is a newer version: 0.6.0
Show newest version
package com.jfreeman.lazy;

/**
 * A lazy constant (i.e. a value with no dependencies).
 */
public final class Constant
    extends AbstractThunk
{
    private Constant(T value) {
        _value = value;
    }

    public static  Constant of(T value) {
        return new Constant<>(value);
    }

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

    @Override
    public Iterable> getDependencies()
        throws IllegalStateException
    {
        throw new IllegalStateException("already forced");
    }

    @Override
    public T force()
        throws IllegalStateException
    {
        throw new IllegalStateException("already forced");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy