I created a simple Counter class:
public class Counter<T> extends HashMap<T, Long> { public Counter() { } public void increase(T key) { put(key, getOrDefault(key, 0l) + 1); } }
In my code, I call the zoom () method and then use the Map method to access the data, for example.
Counter<Integer> counter = new Counter<>(); for (Integer i: ... some collection ...) counter.increase(i);
Intellij highlights the counter declaration (the first line in the last fragment) with a warning color, and in the tooltip message
The contents of the collection are requested but never updated.
Obviously, I can simply ignore this warning, but is there a way to convince Intellij that something is wrong with my code?
I use the 14.0.2 community.
source share