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

Scala example source code file (MapMethods.scala)

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

a, a, b, b, b1, b1, boolean, c, iterable, iterator, map, map, maplike, this

The Scala MapMethods.scala source code

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

package scala.collection
package interfaces

import generic._

/**
 * @since 2.8
 */
trait MapMethods[A, +B, +This <: MapLike[A, B, This] with Map[A, B]]
          extends IterableMethods[(A, B), This]
             with SubtractableMethods[A, This] {
  self: Map[A, B] =>

  // abstract
  def empty: This
  def get(key: A): Option[B]
  def iterator: Iterator[(A, B)]
  def + [B1 >: B] (kv: (A, B1)): Map[A, B1]
  def - (key: A): This

  // concrete
  def getOrElse[B1 >: B](key: A, default: => B1): B1
  def apply(key: A): B
  def contains(key: A): Boolean
  def isDefinedAt(key: A): Boolean
  def keys: Iterable[A]
  def keysIterator: Iterator[A]
  def keySet: Set[A]
  def values: Iterable[B]
  def valuesIterator: Iterator[B]
  def default(key: A): B
  def filterKeys(p: A => Boolean): Map[A, B]
  def mapValues[C](f: B => C): Map[A, C]
  def updated [B1 >: B](key: A, value: B1): Map[A, B1]
  def + [B1 >: B] (elem1: (A, B1), elem2: (A, B1), elems: (A, B1) *): Map[A, B1]
  def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): Map[A, B1]
}

Other Scala examples (source code examples)

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