@param obj @return true if the obj is an instance of Key and if the button IDs are the same.
(final Object obj)
| 260 | * @return true if the {@code obj} is an instance of {@link Key} and if the button IDs are the same. |
| 261 | */ |
| 262 | @Override |
| 263 | public boolean equals(final Object obj) { |
| 264 | if (obj == null || ! (obj instanceof Key)) { |
| 265 | return false; |
| 266 | } else if (obj == this) { // pointer comparison |
| 267 | return true; |
| 268 | } else { |
| 269 | return ((int)this.keyType.getId() == ((Key)obj).getId()); |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * @return the button ID based hash code |