Skip to content

Instantly share code, notes, and snippets.

@onlyshk
Created October 31, 2011 15:34
Show Gist options
  • Save onlyshk/1327768 to your computer and use it in GitHub Desktop.
Save onlyshk/1327768 to your computer and use it in GitHub Desktop.
java Eq interface
enum ColorType {
Red,
Yellow,
Green
}
interface Eq<T> {
Boolean eq(T a, T b);
}
public class Color implements Eq<Color>{
private ColorType cl;
public ColorType getColor() {
return cl;
}
public Color(ColorType color) {
cl = color;
}
public Boolean eq(Color cl1, Color cl2)
{
if (cl1.cl == cl2.cl)
return true;
else
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment