Class HashTable

java.lang.Object
ch.hslu.exercises.sw04.ex1.HashTable
All Implemented Interfaces:
Table<Integer>

public final class HashTable extends Object implements Table<Integer>
  • Constructor Details

    • HashTable

      public HashTable(int size)
  • Method Details

    • add

      public boolean add(Integer element)
      Description copied from interface: Table
      Add Element to Table.
      Specified by:
      add in interface Table<Integer>
      Parameters:
      element - to be added
      Returns:
      true if element could be added, false if not
    • remove

      public boolean remove(Integer element)
      Description copied from interface: Table
      Remove element from Table.
      Specified by:
      remove in interface Table<Integer>
      Parameters:
      element - to be removed.
      Returns:
      true if element was removed, false if not
    • contains

      public boolean contains(Integer element)
      Description copied from interface: Table
      Checks if an element is in the table.
      Specified by:
      contains in interface Table<Integer>
      Parameters:
      element - to be checked
      Returns:
      true if present, false if not
    • size

      public int size()
      Description copied from interface: Table
      Return the amount of elements in the table.
      Specified by:
      size in interface Table<Integer>
      Returns:
      the amount of elements
    • toString

      public String toString()
      Overrides:
      toString in class Object