Skip to content
Advertisement

Check if last taken Map element is last

Faced a problem where I need to put elements in two different Maps and after go through all of them and put if condition on the last element of the last Map.

Here I have code I’ve tried:

JavaScript

Now I have two for loops where I want to check if both for loops have last element right now: I have tried with .size() but that didn’t help with Map

JavaScript

Advertisement

Answer

I guess, this will be really useful for you.

lastKey method of TreeMap.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement