Which is the best way to compare enums in Java?
Asked
Active
Viewed 84 times
1
-
3It's a matter of taste. No strong argument exists either way. Where I work we are using `==`. For code I post on Stack Overflow I tend to use `.equals()` not to lead anyone to think you can genrally use `==` between objects. – Ole V.V. Jan 19 '20 at 20:44
-
See source, [`Enum.java`](https://github.com/bpupadhyaya/openjdk-8/blob/master/jdk/src/share/classes/java/lang/Enum.java#L142) – tevemadar Jan 19 '20 at 20:46