Groovy Find Index of Element in Map -
i have following groovy map ,
def mymap=["txt_txt":1,"img_txt":2,"txt_img":3,"img_img":4]
how can find index of element in map?
use findindexof method following :
def mymap=["txt_txt":1,"img_txt":2,"txt_img":3,"img_img":4] assert 3 == mymap.findindexof{it.key=="img_img"} assert 0 == mymap.findindexof{it.value==1}
Comments
Post a Comment