Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
GalaxiAPI/global/src/net/ME1312/Galaxi/Library/PrimitiveContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |