Update CONTRIBUTING.md

This commit is contained in:
Anuken
2019-11-20 16:58:34 -05:00
committed by GitHub
parent 8be948300e
commit 2a8fca33ea

View File

@ -43,6 +43,13 @@ Instead of using `java.util.List`, `java.util.HashMap`, and other standard Java
Why? Because that's what the rest of the codebase uses, and the standard collections have a lot of cruft and usability issues associated with them.
In the rare case that concurrency is required, you may use the standard Java classes for that purpose (e.g. `CopyOnWriteArrayList`).
What you'll usually need to change:
- `HashSet` -> `ObjectSet`
- `HashMap` -> `ObjectMap`
- `List` / `ArrayList` / `Stack` -> `Array`
- `java.util.Queue` -> `io.anuke.arc.collection.Queue`
- *Many others*
#### Avoid boxed types (Integer, Boolean)
Never create variables or collections with boxed types `Array<Integer>` or `ObjectMap<Integer, ...>`. Use the collections specialized for this task, e.g. `IntArray` and `IntMap`.