Skip to content

Files

Latest commit

 

History

History
11 lines (6 loc) · 550 Bytes

ExplicitHashMapInstantiation.md

File metadata and controls

11 lines (6 loc) · 550 Bytes

Pattern: Explicit HashMap instantiation

Issue: -

Description

This rule checks for explicit calls to the no-argument constructor of HashMap. In Groovy, it is best to replace new HashMap() with [:], which creates (mostly) the same object. [:] is technically a LinkedHashMap but it is very rare that someone absolutely needs an instance of HashMap and not a subclass.

Further Reading