title: Switching two elements in a Linked List
body: <p>Is there a way to switch two elements in a linked list without removing and reinserting them? The code I am currently using is:</p>
  
  <pre><code>void exchange(int i, int j) {
      int[] temp = matrix.get(i);
      matrix.remove(i);
      matrix.add(i, matrix.get(j - 1));
      matrix.remove(j);
      matrix.add(j, temp);
  }
  </code></pre>
  
  <p>where <code>matrix</code> is my linked list.</p>