emptyset.scala

来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 37 行

SCALA
37
字号
/*                     __                                               *\**     ________ ___   / /  ___     Scala API                            ****    / __/ __// _ | / /  / _ |    (c) 2003-2007, LAMP/EPFL             ****  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **** /____/\___/_/ |_/____/_/ | |                                         ****                          |/                                          **\*                                                                      */// $Id: EmptySet.scala 10242 2007-03-08 10:29:26Z spoon $package scala.collection.immutable/** This class implements empty immutable sets *  @author  Martin Oderskty *  @version 1.0, 019/01/2007 */@serializableclass EmptySet[A] extends Set[A] {  def empty[C]: Set[C] = new EmptySet[C]  def size: Int = 0  def contains(elem: A): Boolean = false  def + (elem: A): Set[A] = new Set1(elem)  def - (elem: A): Set[A] = this  def elements: Iterator[A] = Iterator.empty}  

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?