Skip to content

Commit

Permalink
Add PrimitiveContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
ME1312 committed Feb 28, 2020
1 parent ad3e8b5 commit aff7b34
Showing 1 changed file with 32 additions and 0 deletions.
@@ -0,0 +1,32 @@
package net.ME1312.Galaxi.Library;

/**
* Primitive Container Class
*
* @param <V> Item
*/
public class PrimitiveContainer<V> {
public V value;

/**
* Creates a Container
*
* @param item Object to Store
*/
public PrimitiveContainer(V item) {
value = item;
}

@Override
public boolean equals(Object object) {
if (object instanceof PrimitiveContainer) {
if (value == null || ((PrimitiveContainer) object).value == null) {
return value == ((PrimitiveContainer) object).value;
} else {
return value.equals(((PrimitiveContainer) object).value);
}
} else {
return super.equals(object);
}
}
}

0 comments on commit aff7b34

Please sign in to comment.