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

io.polaris.core.tuple.ValueRef Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package io.polaris.core.tuple;


import java.io.Serializable;
import java.util.Objects;

/**
 * @author Qt
 * @since 1.8
 */
public class ValueRef implements Ref, Serializable {
	private static final long serialVersionUID = 1L;
	private final V value;

	public ValueRef(V value) {
		this.value = value;
	}

	@Override
	public V get() {
		return value;
	}

	public static  ValueRef of(final E value) {
		return new ValueRef<>(value);
	}

	@Override
	public String toString() {
		return "ValueRef{value=" + value + '}';
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		ValueRef valueRef = (ValueRef) o;
		return Objects.equals(value, valueRef.value);
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy