Is it a best practice in Java to declare variables before give them as parameters : <p>Assuming this code :</p>

<pre><code>public static Dataset&lt;Row&gt; getData(SparkSession sparkSession,
                                             StructType schema, String delimiter, String pathToData) {

    final Dataset&lt;Row&gt; dataset = sparkSession
            .read()
            .option("delimiter", "\\t")
            .csv(pathToData);

    StructType nSchema= newSchema(schema, schema.size(), dataset.columns().length);
 ...
}
</code></pre>

<p>Is it a best practice to declare variables and make them final before giving them to newSchema method, like this ?</p>

<pre><code>public static Dataset&lt;Row&gt; getData(SparkSession sparkSession,
                                             StructType schema, String delimiter, String pathToData) {

    final Dataset&lt;Row&gt; dataset = sparkSession
            .read()
            .option("delimiter", "\\t")
            .csv(pathToData);

    final int dataSize = dataset.columns().length;
    final int schemaSize = schema.size();

    StructType nSchema = newSchema(schema, schemaSize, dataSize);
 ...
}
</code></pre>

<p>Thank you</p>
