Java
Functions
Runnable () -> ()
Supplier () -> x
Callable () -> x throws ex
Consumer x -> ()
BiConsumer x,y -> ()
Function x -> y
Predicate x -> boolean
BiFunction x,y -> z
UnaryOperator x1 -> x2
BinaryOperator x1,x2 -> x3
Class member ordering
Generally, organize the code in such a way, that the reader does not need to jump around while reading the code, but can follow it top to bottom to the level of detail necessary
https://stackoverflow.com/a/1760869/12393574
- Static Variables
- Static Methods
- Public Variables
- Protected Variables
- Private Variables
- Constructors
- Public Methods
- Protected Methods
- Private Methods
static before anything
variables before constructors before methods
public before protected before private
The idea is that you define the object (the data), before the behaviours (methods). Statics need to be separated because they aren't really part of the object, nor it's behaviour.
No comments to display
No comments to display