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

Scala example source code file (ParMapLike.scala)

This example Scala source code file (ParMapLike.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

cloneable, k, k, option, parmap, parmaplike, repr, repr, sequential, sequential, u, unit, v, v

The Scala ParMapLike.scala source code

/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2003-2011, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

package scala.collection.parallel
package mutable



import collection.generic._
import collection.mutable.Builder
import collection.mutable.Cloneable



/** A template trait for mutable parallel maps. This trait is to be mixed in
 *  with concrete parallel maps to override the representation type.
 *  
 *  $sideeffects
 *  
 *  @tparam K    the key type of the map
 *  @tparam V    the value type of the map
 *  
 *  @author Aleksandar Prokopec
 *  @since 2.9
 */
trait ParMapLike[K,
                 V,
                 +Repr <: ParMapLike[K, V, Repr, Sequential] with ParMap[K, V],
                 +Sequential <: collection.mutable.Map[K, V] with collection.mutable.MapLike[K, V, Sequential]]
extends collection.GenMapLike[K, V, Repr]
   with collection.parallel.ParMapLike[K, V, Repr, Sequential] 
   with Cloneable[Repr] {
  
  // note: should not override toMap
  
  def put(key: K, value: V): Option[V]
  
  def +=(kv: (K, V)): this.type
  
  def -=(key: K): this.type
  
  def +[U >: V](kv: (K, U)) = this.clone().asInstanceOf[ParMap[K, U]] += kv
  
  def -(key: K) = this.clone() -= key
  
  def clear(): Unit
  
}
   

Other Scala examples (source code examples)

Here is a short list of links related to this Scala ParMapLike.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.