function0.scala

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

SCALA
43
字号
/*                     __                                               *\**     ________ ___   / /  ___     Scala API                            ****    / __/ __// _ | / /  / _ |    (c) 2002-2008, LAMP/EPFL             ****  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **** /____/\___/_/ |_/____/_/ | |                                         ****                          |/                                          **\*                                                                      */// $Id: Function0.scala 14670 2008-04-16 14:47:55Z washburn $// generated by genprod on Wed Apr 16 16:46:04 CEST 2008 (with fancy comment) package scala/** <p> *    Function with 0 parameters. *  </p> *  <p>      In the following example the definition of *    <code>currentSeconds</code> is a shorthand for the anonymous class *    definition <code>anonfun0</code>: *  </p> *  <pre> *  <b>object</b> Main <b>extends</b> Application { * *    <b>val</b> currentSeconds = () => System.currentTimeMillis() / 1000L * *    <b>val</b> anonfun0 = <b>new</b> Function0[Long] { *      <b>def</b> apply(): Long = System.currentTimeMillis() / 1000L *    } * *    println(currentSeconds()) *    println(anonfun0()) *  }</pre> */trait Function0[+R] extends AnyRef {  def apply(): R  override def toString() = "<function>"  }

⌨️ 快捷键说明

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