mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 23:38:10 +07:00
Update CONTRIBUTING.md
This commit is contained in:
@ -40,20 +40,20 @@ In general, if you are using IntelliJ, you should be warned about platform incom
|
||||
|
||||
|
||||
#### Use `arc` collections and classes when possible.
|
||||
Instead of using `java.util.List`, `java.util.HashMap`, and other standard Java collections, use `Array`, `ObjectMap` and other equivalents from `arc.struct`.
|
||||
Instead of using `java.util.List`, `java.util.HashMap`, and other standard Java collections, use `Seq`, `ObjectMap` and other equivalents from `arc.struct`.
|
||||
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`
|
||||
- `List` / `ArrayList` / `Stack` -> `Seq`
|
||||
- `java.util.Queue` -> `arc.struct.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`.
|
||||
Never create variables or collections with boxed types `Seq<Integer>` or `ObjectMap<Integer, ...>`. Use the collections specialized for this task, e.g. `IntSeq` and `IntMap`.
|
||||
|
||||
|
||||
#### Do not allocate anything if possible.
|
||||
|
Reference in New Issue
Block a user