Class Fib

All Implemented Interfaces:
Iterable<BigInteger>, Iterator<BigInteger>, Fiber.Worker

public class Fib extends Generator<BigInteger>
This example prints the nth Fibonacci number. It illustrates a generator, which is part iterator, part task. It returns the next object 'yielded' by its execute method. The difference between a generator and a task is that the former is invoked by the caller synchronously on the caller's stack; it is not scheduled in a separate thread.
  • Constructor Details

    • Fib

      public Fib()
  • Method Details

    • main

      public static void main(String[] args)
    • execute

      public void execute() throws Pausable
      Description copied from class: Continuation
      the top level entrypoint for the continuation override this method cannot be called directly - use run() instead use Fiber.yield() to yield control cooperatively and return execution to the caller of run()
      Specified by:
      execute in interface Fiber.Worker
      Overrides:
      execute in class Continuation
      Throws:
      Pausable