|
Scala example source code file (spec-sparsearray.scala)
The Scala spec-sparsearray.scala source codeimport scala.collection.mutable.MapLike class SparseArray[@specialized(Int) T:ClassManifest] extends collection.mutable.Map[Int,T] with collection.mutable.MapLike[Int,T,SparseArray[T]] { override def get(x: Int) = { val ind = findOffset(x) if(ind < 0) None else Some(error("ignore")) } /** * Returns the offset into index and data for the requested vector * index. If the requested index is not found, the return value is * negative and can be converted into an insertion point with -(rv+1). */ private def findOffset(i : Int) : Int = { error("impl doesn't matter") } override def apply(i : Int) : T = { error("ignore") } override def update(i : Int, value : T) = error("ignore") override def empty = new SparseArray[T] def -=(ind: Int) = error("ignore") def +=(kv: (Int,T)) = error("ignore") override final def iterator = error("ignore") } Other Scala examples (source code examples)Here is a short list of links related to this Scala spec-sparsearray.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.