mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-31 01:44:22 +07:00
Update CONTRIBUTING.md
This commit is contained in:
parent
8be948300e
commit
2a8fca33ea
@ -41,7 +41,14 @@ 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 `io.anuke.arc.collection`.
|
||||
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`).
|
||||
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)
|
||||
@ -59,4 +66,4 @@ If something needs to be encapsulated in the future, IntelliJ can handle it with
|
||||
|
||||
|
||||
#### Do not create methods unless necessary.
|
||||
Unless a block of code is very large or used in more than 1-2 places, don't split it up into a separate method. Making unnecessary methods only creates confusion, and may slightly decrease performance.
|
||||
Unless a block of code is very large or used in more than 1-2 places, don't split it up into a separate method. Making unnecessary methods only creates confusion, and may slightly decrease performance.
|
||||
|
Loading…
Reference in New Issue
Block a user