![JAR search and dependency download from the Maven repository](/logo.png)
xdean.jex.extra.collection.Wrapper Maven / Gradle / Ivy
The newest version!
package xdean.jex.extra.collection;
import java.util.Objects;
import xdean.jex.extra.annotation.marker.NotThreadSafe;
@NotThreadSafe
public class Wrapper {
public static Wrapper of(T t) {
return new Wrapper<>(t);
}
public static Wrapper empty() {
return Wrapper.of(null);
}
private T value;
public Wrapper(T value) {
super();
this.value = value;
}
public T get() {
return value;
}
public void set(T t) {
value = t;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
} else if (obj == null) {
return false;
} else if (!(obj instanceof Wrapper)) {
return false;
}
Wrapper> other = (Wrapper>) obj;
return Objects.equals(value, other.value);
}
@Override
public String toString() {
return "Wrapper [value=" + value + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy