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

io.magentys.utils.Any Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
package io.magentys.utils;

import static io.magentys.utils.Requires.requiresNotNull;

public class Any {

    private final T t;

    public Any(final T t){
        this.t = requiresNotNull(t, "You cannot create 'Any' of a null value");
    }

    public static  Any any(final T t) {
        return new Any(t);
    }

    public T get(){
        return t;
    }

    public boolean equals(final Object o){
        if(o == null) return false;
        if(o instanceof Any){
            Any any = (Any) o;
            if(any.get() == t) return true;
            return any.get().equals(t);
        }
        else return false;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy