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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -