Skip to content

Use final keyword when possible #35

@yungpanda

Description

@yungpanda

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.
E.g. LoginActivity has private static final and private final static which looks messy.

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".... *

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions