我有以下Groovy域类:
class A {
def lotOfBs = []
}
现在,我需要从一个Java类迭代该数组。这些解决方案不起作用:
for ( B b : a.getLotOfBs() ){
//COMPILATION ERROR
}
for ( int i = 0 ; i < a.getLotOfBs().length ; i++ ){
//LENGTH ATTRIBUTE DOES NOT EXIST OR IT IS NOT VISIBLE
}
for ( int i = 0 ; i < a.getLotOfBs().size() ; i++ ){
//SIZE METHOD DOES NOT EXIST
}
你有什么建议吗?
提前致谢