Yield Return In Java

后端 未结 10 1237
春和景丽
春和景丽 2020-12-13 23:13

I\'ve created a linked list in java using generics, and now I want to be able to iterate over all the elements in the list. In C# I would use yield return insid

10条回答
  •  再見小時候
    2020-12-13 23:38

    If you want the full functionality of yield return, you probably need to set this up in two threads-- one for the first method, and one for the second. Then the first thread should wait until the second thread puts its value somewhere accessible and notifys it that it's ready. Then the first thread would process that value, wait for the next value, etc.

提交回复
热议问题