title: In java, how to swap two values in a Vector?
body: <pre><code>import java.util.Scanner;
  import java.util.Vector;
  import java.util.Collections;
  
  public class Bank implements BubbleSort{
   private Vector&lt;Account&gt; accounts;
  
   public Bank() {
    accounts = new Vector&lt;Account&gt;();
   }
   public void makeAccount() {
    Scanner in = new Scanner(System.in);
    int amount;
    while(true) {
     System.out.println("Input");
     amount = in.nextInt();
     if(amount&lt;0)
      break;
     accounts.add(new Account(amount));
  
    }
   }
   public void printAccount() {
    for (int i=0;i&lt;accounts.size();i++) {
     System.out.println(accounts.get(i).get());
    }
  
   }
   @Override
      public void start() {
          // TODO Auto-generated method stub
          for (int i = 0; i &lt; accounts.size() - 1; i++) {
              for (int j = 0; j &lt; accounts.size() - 1 - i; j++)
                  if (isGreater(j, j + 1))
                      swap(j, j + 1);
          }
      }
      @Override
      public void swap(int a, int b) {
          // TODO Auto-generated method stub
  
  
          Account temp = accounts.get(a);
          accounts.get(a) = accounts.get(b); //error
          accounts.get(b) = temp; //error
      }
  
      @Override
      public boolean isGreater(int a, int b) {
  
  
          // TODO Auto-generated method stub
  
  
          return accounts.get(a).get() &gt; accounts.get(b).get();
      }
  }
  </code></pre>
  
  <p>In swap code, "The left-hand side of an assignment must be a variable" error occurs.
  How can I fix that code?
  In mission, I can't use collection package.
  I found a lot of codes in google or stackoverflow, but they have not been resolved.</p>