title: Pointer to an Integer in Java
body: <p>I have a code like this</p>
  
  <pre><code>int a,b;
  switch(whatever){
      case 1:
        lots_of_lines_dealing_with_variable_a;
      case 2:
        same_lines_but_dealing_with_variable_b;
  }
  </code></pre>
  
  <p>I thought of doing:</p>
  
  <pre><code>int a,b;
  pointer_to_int p;
  switch(whatever){
      case 1:
        p=a;
      case 2:
        p=b;
  }
  lots_of_lines_dealing_with_pointer_p;
  </code></pre>
  
  <p>It would reduce the code to about half the lines, but Java doesn't allow pointers to integers. So, is there any way to approach this?</p>
  
  <p>Edit: The homework is much bigger than just this method. I need to Create a class called "DoubleList" which contains two linked lists in a single Vector. The integers I talk about are the pointers to the start of the Lists, which I need to move to other positions of the Lists when adding or removing elements to the Lists</p>