Giter Club home page Giter Club logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
[Environment]
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

Original comment by hh9527 on 22 Feb 2008 at 6:19

from infomancers-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Just so I understand, can you post the entire output for both expected and 
actual?

Original comment by [email protected] on 22 Feb 2008 at 7:54

from infomancers-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Another sample (simpler to explain)

-- motivation --
1. the 'test' method will yield 2 integers(1 and 2)
2. the 'main' method will call 'test' to got a generator, and visit each item 
(1 and
2 in this case) in the generator.

-- code --
package com.bestsoft.testjyield;

import com.infomancers.collections.yield.Yielder;

public class Foo {
    public static Iterable<Integer> test() {
        return new Yielder<Integer>() {
            public void yieldNextCore() {
                System.out.println("Yielding 1");
                yieldReturn(1);
                System.out.println("Yielding 2");
                yieldReturn(2);
            }
        };
    }

    public static void main(String[] args) {
        System.out.println("[BEGIN]");
        Iterable<Integer> iter = test();
        for (Integer i : iter) {
            System.out.println("Got " + i);
        }
        System.out.println("[DONE]");
    }
}

-- expected output --
[BEGIN]
Yielding 1
Got 1
Yielding 2
Got 2
[DONE]

-- actually output --
[BEGIN]
Yielding 1
Yielding 2
Got 2
Yielding 1
Yielding 2
Got 2
Yielding 1
Yielding 2
Got 2
... (INFINITE LOOP)

Original comment by hh9527 on 25 Feb 2008 at 2:33

from infomancers-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Sorry for the delay, it took a long time to get back to the yielder project.

This seems like a really odd bug. In any case, I rewrote the second example in 
a unit test, see class Issue13 in 
the trunk version. This works now.

Please verify that it does.

Original comment by [email protected] on 8 Aug 2009 at 2:47

  • Changed state: Fixed

from infomancers-collections.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.