Shorten lines of code in case statements inside switch block
<p>I have 10 cases in my switch statement. Each of them does the same thing with the other except that the assignments are different. If I have to change 1 line of code (during development) in one case block then I have to change all other 9 cases manually.</p>

<p>Here are the scenarios of each case statements:</p>

<ol>
<li>Each case contains long lines of code with many function calls and assignments.</li>
<li>Only variable assignments, function arguments, and if statement conditions vary.</li>
<li>There is no pattern/sequence in the assignment of variables and function arguments.</li>
<li>Adding helper functions and calling them on each case statements is almost impossible for some reason.</li>
</ol>

<p>How do I optimize or shorten this?</p>

<p>To illustrate:</p>

<pre><code>final int CONSTANT_A = 0;
final int CONSTANT_B = 1;
...
final int CONSTANT_J = 10;

int varA = 0;
int varB = 1;
...
int varJ = 10;

int anothervarA = 0;
int anothervarB = 1;
...
int anothervarJ = 10;

int action = 0;

switch(something) {
    case 1:
        ... long lines of code here
        // If I have to change the variables below
        // then I have to update all other variables in
        // other cases below
        varA = CONSTANT_J;
        anothervarA = CONSTANT_B;
        ... another long lines of code here
        int ret = someObject.foo(varA);
        ... do something with ret.
        action = 5;
        break;
    case 2:
        ... long lines of code here
        varB = CONSTANT_I;
        anothervarB = CONSTANT_C
        ... another long lines of code here
        int ret = someObject.foo(varA);
        ... do something with ret.
        action = 100;
        break;
    ...
    ...
    case 9:
        ... long lines of code here
        varI = CONSTANT_B;
        anothervarI = CONSTANT_A;
        ... another long lines of code here
        int ret = someObject.foo(varA);
        ... do something with ret.
        action = 100;
        break;
    case 10:
        ... long lines of code here
        varK = CONSTANT_A;
        anothervarJ = CONSTANT_F;
        ... another long lines of code here
        int ret = someObject.foo(varA);
        ... do something with ret.
        action = 4;
        break;
}
</code></pre>
