in cassovary-core/src/main/scala/com/twitter/cassovary/util/Int2ObjectMap.scala [12:31]
def apply[T : ClassTag](isSparse: Boolean, numKeysEstimate: Option[Int],
maxId: Option[Int], isConcurrent: Boolean): mutable.Map[Int, T] = {
if (isSparse) {
if (isConcurrent) {
numKeysEstimate match {
case Some(n) => new ConcurrentHashMap[Int, T](n, 0.4f).asScala
case None => new ConcurrentHashMap[Int, T]().asScala
}
} else {
numKeysEstimate match {
case Some(n) =>
new Int2ObjectOpenHashMap[T](n, 0.4f).asInstanceOf[java.util.Map[Int, T]].asScala
case None =>
new Int2ObjectOpenHashMap[T]().asInstanceOf[java.util.Map[Int, T]].asScala
}
}
} else {
new ArrayBackedInt2ObjectMap[T](maxId.get)
}
}