SubServers-2/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Library/Container.java

51 lines
955 B
Java
Raw Normal View History

2016-12-24 05:55:17 +01:00
package net.ME1312.SubServers.Bungee.Library;
2016-12-05 04:21:04 +01:00
/**
* Container Class
*
2017-01-07 20:06:54 +01:00
* @param <V> Item
2016-12-05 04:21:04 +01:00
*/
public class Container<V> {
private V obj;
2016-12-05 04:21:04 +01:00
/**
* Creates a Container
*
* @param item Object to Store
*/
public Container(V item) {
2016-12-05 04:21:04 +01:00
obj = item;
}
/**
* Grabs the Object
*
* @return The Object
*/
public V get() {
2016-12-05 04:21:04 +01:00
return obj;
}
/**
* Overwrite the Object
*
* @param value Object to Store
*/
public void set(V value) {
2016-12-05 04:21:04 +01:00
obj = value;
}
@Override
public boolean equals(Object object) {
if (object instanceof Container) {
if (obj == null || ((Container) object).get() == null) {
return obj == ((Container) object).get();
} else {
return obj.equals(((Container) object).get());
}
} else {
return super.equals(object);
}
}
2016-12-05 04:21:04 +01:00
}