Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use final when possible #1

Open
yungpanda opened this issue Jul 23, 2014 · 0 comments
Open

Use final when possible #1

yungpanda opened this issue Jul 23, 2014 · 0 comments
Milestone

Comments

@yungpanda
Copy link

It's a good practice to use the final keyword as much as possible.
Every variable that isn't going to change it's value should be declared final.

Global variables
If you have constant fields they should be declared final for performance. The order of static and final doesn't matter, but try to keep the order the same in all your files.

Variables inside methods
See http://programmers.stackexchange.com/questions/115690/why-declare-final-variables-inside-methods
*.... It's a good habit to get into along with a number of others; eg: "Make everything final by default, unless otherwise required", "Make everything private by default, unless otherwise required".... *

@yungpanda yungpanda added this to the Code cleaning milestone Jul 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant