Created
October 31, 2011 15:34
-
-
Save onlyshk/1327768 to your computer and use it in GitHub Desktop.
java Eq interface
This file contains hidden or 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
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