Skip to content

Commit e8dc8ed

Browse files
committed
Add note about recommend variable type
1 parent 8c2a20c commit e8dc8ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

concepts/maps/about.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Java has a number of different Map implementations.
1414
Map<String, Integer> fruitPrices = new HashMap<>();
1515
```
1616

17+
~~~~exercism/note
18+
When defining a `Map` variable, it is recommended to define the variable as a `Map` type rather than the specific type, as in the above example.
19+
This practice makes it easy to change the `Map` implementation later.
20+
~~~~
21+
1722
`HashMap` also has a copy constructor.
1823

1924
```java

0 commit comments

Comments
 (0)