나는 javaflow에서 매우 초보자입니다.Javaflow에서 두 개의 연속을 비교하는 방법은 무엇입니까?
class MyRunnable implements Runnable {
public void run() {
System.out.println("started!");
for(int i=0; i<10; i++)
echo(i);
}
private void echo(int x) {
System.out.println(x);
Continuation.suspend();
}
}
Continuation c = Continuation.startWith(new MyRunnable());
Continuation d = Continuation.continueWith(c);
Continuation e = Continuation.continueWith(d);
Continuation f = Continuation.continueWith(d);
if (e.equals(f)) System.out.println("They are equal!");
else System.out.println("They are not equal!");
모두 계속 같은 체크 포인트 (D)와 E와 F의 시작과 같은 스택을 캡처하고 그들은 동일한 가없는 이유 "또한 둘은 여전히 그런 1. 인쇄 : 다음과 같은 기본 예제를 생각해 봅시다! "? (프로그램에서이 출력을 제공합니다). 누군가 제게 설명해 주시겠습니까?
+1 왜냐하면 나는 전에 javaflow에 대해 들어 본 적이 없기 때문입니다. 깔끔한 - coroutines! –