title: Attempting to understand the hashmap data structure
body: <p>I am working on a homework assignment that deals with constructing a hashmap data structure, and I'm not understanding a line of code that was given to us. In the program, a variable is initiated as follows: </p>
  
  <pre><code>private Map&lt;K,V&gt;[] buckets;
  </code></pre>
  
  <p>I know what the concept of buckets are when used in a hashmap, but how can I use a map array to create buckets? When I look at this code, it seems as though I need to create an array of hashmaps, but that doesn't make sense at all.</p>
  
  <p>If you need any more information, just let me know.</p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Below is the code that was provided. </p>
  
  <pre><code>package cs2321;
  
  import net.datastructures.*;
  
  public class HashMap&lt;K, V&gt; implements Map&lt;K, V&gt; {
  
  private Map&lt;K,V&gt;[] buckets;
  
  protected final int mDefaultHashSize = 1021;
  
  /**
   * Constructor that takes a hash size
   * @param hashsize The number of buckets to initialize
   *                 in the HashMap
   */
  public HashMap(int hashsize){
      // TODO: Be sure to initialize the bucket array
      //       using the hashsize given as the number of buckets
  }
  
  public HashMap(){
      // TODO: Be sure to initialize the bucket array
      //       using the default hash size provided.
  }
  
  
  public Iterable&lt;Entry&lt;K, V&gt;&gt; entrySet() {
      // TODO Auto-generated method stub
      return null;
  }
  
  public V get(K key) throws InvalidKeyException {
      // TODO Auto-generated method stub
      return null;
  }
  
  public boolean isEmpty() {
      // TODO Auto-generated method stub
      return false;
  }
  
  public Iterable&lt;K&gt; keySet() {
      // TODO Auto-generated method stub
      return null;
  }
  
  public V put(K key, V value) throws InvalidKeyException {
      // TODO Auto-generated method stub
      return null;
  }
  
  public V remove(K key) throws InvalidKeyException {
      // TODO Auto-generated method stub
      return null;
  }
  
  public int size() {
      // TODO Auto-generated method stub
      return 0;
  }
  
  public Iterable&lt;V&gt; values() {
      // TODO Auto-generated method stub
      return null;
  }
  </code></pre>
  
  <p>}</p>