title: Java sort ArrayList with custom fields by number and alphabetically
body: <pre><code>public class Product implements Serializable{
  
      private String id;
      private String name;
      private double price ;
      private int quantity;
  
      public Product(String id, String name, double price, int quantity) {
          this.id = id;
          this.name = name;
          this.price = price;
          this.quantity = quantity;
      }
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public double getPrice() {
          return price;
      }
  
      public void setPrice(double price) {
          this.price = price;
      }
  
      public int getQuantity() {
          return quantity;
      }
  
      public void setQuantity(int quantity) {
          this.quantity = quantity;
      }
  
      @Override
      public String toString() {
          return "Product{" + "id=" + id + ", name=" + name + ", price=" + price + ", quantity=" + quantity + '}';
      }
  </code></pre>
  
  <p>I want to sort <code>ArrayList&lt;Product&gt;</code> by price and name. I search Google for a long time but I cann't solve it. Whether it can have problem with <strong>Serializable</strong></p>