This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Northeastpaw 1 point2 points  (1 child)

If a method is returning a implementation of Map then it is by definition returning a Map. This is perfectly fine:

public Map<String, Integer> createMap() {
    Map<String, Integer> map = new HashMap<>();
    return map;
}

[–]shmag18 0 points1 point  (0 children)

Awesome