Update CONTRIBUTING.md

This commit is contained in:
Anuken 2019-11-20 16:58:34 -05:00 committed by GitHub
parent 8be948300e
commit 2a8fca33ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.