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

Scala example source code file (Future.scala)

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

boolean, boolean, future, future, r, r

The Scala Future.scala source code

package scala.parallel







/** A future is a function without parameters that will block the caller if the
 *  parallel computation associated with the function is not completed.
 *  
 *  @since 2.9
 */
trait Future[@specialized +R] extends (() => R) {
  /** Returns a result once the parallel computation completes. If the computation
   *  produced an exception, an exception is forwarded.
   *  
   *  '''Note:''' creating a circular dependency between futures by calling this method will
   *  result in a deadlock.
   *  
   *  @tparam R   the type of the result
   *  @return     the result
   *  @throws     the exception that was thrown during a parallel computation
   */
  def apply(): R
  
  /** Returns `true` if the parallel computation is completed.
   *  
   *  @return     `true` if the parallel computation is completed, `false` otherwise
   */
  def isDone(): Boolean
}



Other Scala examples (source code examples)

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