【发布时间】:2012-12-06 20:03:53
【问题描述】:
我一定快疯了,但为什么 Groovy findIndexValues 返回List<long>?我可以获取 Integer 的索引吗?
foo = ['a','b','d','e', 'e','e']
indices = foo.findIndexValues { it == 'e'}
indices.each { println foo[it] }
上面会崩溃,因为 foo 集合不能处理 long 作为访问索引。我没有使用应有的语言吗?
【问题讨论】:
标签: collections types groovy