Java iterator over an empty collection of a parameterized type

后端 未结 7 1509
隐瞒了意图╮
隐瞒了意图╮ 2021-01-03 18:36

In Java, I need to return an Iterator from my method. My data comes from another object which usually can give me an iterator so I can just return that, but in some circums

相关标签:
7条回答
  • 2021-01-03 19:19

    You can get an empty list of type Foo through the following syntax:

    return Collections.<Foo>emptyList().iterator();
    
    0 讨论(0)
提交回复
热议问题