HashMapでeachWithIndex
HashMapのキーと値のペアをインデックス付きで取り出します。
def m = [field1:"f1",field2:"f2",field3:"f3"] m.eachWithIndex{k,v,i-> println k + ":" + v + ":" + i } // 出力 field1:f1:0 field2:f2:1 field3:f3:2
HashMapのキーと値のペアをインデックス付きで取り出します。
def m = [field1:"f1",field2:"f2",field3:"f3"] m.eachWithIndex{k,v,i-> println k + ":" + v + ":" + i } // 出力 field1:f1:0 field2:f2:1 field3:f3:2