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

matlab - How to equate a structure array to structure array -

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -