Socrative Quiz

When a class overrides equals it should also override hashCode. Consider the following hashCode implementation:

  @Override
  public int hashCode() {
    return 1;
  }

Assuming the HashTable implementation from last week’s lab, how will this hashCode function perform in practice?

  1. There method is fine. Hashing will work correctly and performance will be OK.
  2. This method will break hashing. Lookups will not work correctly.
  3. Lookups will work correctly with this method, but lookup performance will be Θ(n).
  4. Lookups will work correctly with this method, but lookup performance will be Θ(n2).


slide 1/11
* help? contents?

Space, Right Arrow or swipe left to move to next slide, click help below for more details