Android final variables

I read the source code of the TextView , and I met this piece of code:

RectF mTmpRectF = new RectF(); float[] mTmpOffset = new float[2]; ExtractedTextRequest mExtracting; final ExtractedText mTmpExtracted = new ExtractedText(); 

So there they define mTmpExtracted as final, but not mTmpRectF.

I read this. What is โ€œfinalโ€ if you put it in front of a variable? where parsed when to use final.

Thus, since both objects (mTmpRectF and mTmpExtracted) can be final in this particular case, is there any other reason (for example, performace, etc.) that only one of them is set to final or is it just a code style developer?

Thanks!

+7
source share
1 answer

I would say that extractText was set to final, so it cannot be changed after it has been extracted, where, since the encoder does not bother if the rectangle is changed.

+7
source

All Articles