i have this kind of data structure

```
Map<Integer, Integer> groupMap= new LinkedHashMap<>();

groupMap.put(10, 1);
groupMap.put(11, 0);
groupMap.put(14, 1);
groupMap.put(13, 0);
groupMap.put(12, 0);
groupMap.put(15, 1);

```

what can be the best way to find the key which has value 1 if i have a present key with one value.
Ex:i have key 14, now need to find the key 15 which has value 1

least looping will be helpfull.

my approch:

```
List<Integer> keys = new ArrayList<>();
keys.putAll(groupMap.keySet());

//getting the index of current key i have
int index = keys.indexOf(14);

if(keys.size() == index) return -1;

for(int i = index+1;i<keys.size();i++){
   if(groupMap.get(i) == 1) return i;
}

```

i know it isn't a very good approach, but can you please suggest a good one.