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

com.ajjpj.abase.collection.AEqualsWrapper Maven / Gradle / Ivy

Go to download

a-base is a library of basic (hence the name) classes, most notably immutable collection classes with copy-on-write operations

There is a newer version: 1.0-pre11
Show newest version
package com.ajjpj.abase.collection;

/**
 * @author arno
 */
public class AEqualsWrapper { //TODO javadoc, junit
    private final AEquality equality;
    public final T value;

    public AEqualsWrapper(AEquality equality, T value) {
        this.equality = equality;
        this.value = value;
    }

    @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
    @Override public boolean equals(Object obj) {
        return equality.equals(value, obj);
    }

    @Override public int hashCode() {
        return equality.hashCode(value);
    }

    @Override
    public String toString() {
        return value.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy