You are viewing a single comment's thread. Return to all comments →
Testing my lambda expression skills a bit more.
Replaced:
if (map.get(old) == 1) { map.remove(old); } else { map.put(old, map.get(old) - 1); }
with:
map.merge(old, -1, (a,b) -> { int result = a+b; return (result == 0) ? null : result; });
Seems like cookies are disabled on this browser, please enable them to open this website
Java Dequeue
You are viewing a single comment's thread. Return to all comments →
Testing my lambda expression skills a bit more.
Replaced:
with: