alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (SameElementsLong.scala)

This example Scala source code file (SameElementsLong.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

array, companion, companion, cont, havingresult, int, int, list, resettable, sameelementslong, sameelementslong, string, string

The Scala SameElementsLong.scala source code

package scala.collection.parallel.benchmarks
package parallel_array







class SameElementsLong(sz: Int, p: Int, what: String)
extends Resettable[Cont](sz, p, what, (i: Int) => new Cont(i),  new Array[Any](_), classOf[Cont])
with HavingResult[Boolean] {
  def companion = SameElementsLong
  override def repetitionsPerRun = 400
  
  val same = {
    val p = new collection.parallel.mutable.ParArray[Cont](sz)
    for (i <- 0 until sz) p(i) = what match {
      case "seq" => arr(i).asInstanceOf[Cont]
      case "par" => pa(i)
    }
    p
  }
  
  def runpar = runresult = pa.sameElements(same)
  def runseq = runresult = sequentialSameElements(same, sz)
  override def comparisonMap = collection.Map()
}

object SameElementsLong extends Companion {
  def benchName = "same-elements-long";
  def apply(sz: Int, p: Int, what: String) = new SameElementsLong(sz, p, what)
  override def comparisons = List()
}











Other Scala examples (source code examples)

Here is a short list of links related to this Scala SameElementsLong.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.