<commit_before>package offheap.collection

class HashMap[K, V]
  extends Map[K, V] {

  def apply(key: K): Opt[V] = ???

  def put(key: K, value: V): Opt[V] = ???

  def remove(key: K): Opt[V] = ???

  def keys: NaiveSet[K] = ???

  def values: NaiveSeq[V] = ???

  def contains(key: K): Boolean = ???

  private def keyIndex(key: K) = ???

  override def isEmpty = ???

  override def size: Int = ???

  override def foreach[U](f: ((K, V)) => U): Unit = ???
}<commit_msg>Some work on HashMap<commit_after>package offheap.collection

// Uses ideas from:
// https://doc.rust-lang.org/std/collections/struct.HashMap.html
// http://sebastiansylvan.com/post/robin-hood-hashing-should-be-your-default-hash-table-implementation/
// http://codecapsule.com/2013/11/11/robin-hood-hashing/
class HashMap[K, V](initialSize: Int = 16) extends Map[K, V] {

  private[this] val hashes: Array[Int] = new Array[Int](initialSize)
  private[this] val _keys: Array[K] = new Array[K](initialSize)
  private[this] val _values: Array[V] = new Array[V](initialSize)
  private[this] var _size = 0

  def apply(key: K): Opt[V] = ???

  def put(key: K, value: V): Opt[V] = ???

  def remove(key: K): Opt[V] = ???

  def keys: NaiveSet[K] = ???

  def values: NaiveSeq[V] = ???

  def contains(key: K): Boolean = this(key).nonEmpty

  private[this] def capacity = _keys.size
  private[this] def mask = _keys.size - 1

  private[this] def init(pos: Int, hash: Int, key: K, value: V) = {
    hashes(pos) = hash
    _keys(pos) = key
    _values(pos) = value
  }



  override def isEmpty = _size == 0

  override def size: Int = _size

  override def foreach[U](f: ((K, V)) => U): Unit = ???
}
{'fraction_non_alphanumeric': 0.18220084185207455, 'fraction_numerical': 0.007817197835237523, 'mean_word_length': 3.6222222222222222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5916292', 'n_tokens_mistral': 654, 'n_tokens_neox': 618, 'n_words': 158}