title: Collection Sort not working with custom ArrayList
body: <p>I want to present my list in sorted form. I know one way to do it is using the <code>Collections</code> class and invoke the <code>sort</code> method. I tried that but it's not working on an <code>ArrayList</code> with my custom class as object.</p>
  
  <p>I tried to use to this method:</p>
  
  <pre><code>Collections.sort(nameOfAmimals);
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>package com.example.hp.learning;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.widget.ListView;
  
  import java.lang.reflect.Array;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  
  public class A_Animals extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_a__animals);
  
  
          ArrayList &lt;Animal&gt; nameOfAmimals = new ArrayList&lt;&gt;();
  
          nameOfAmimals.add(new Animal("Cat" , ""));
          nameOfAmimals.add(new Animal("Dog" , ""));
          nameOfAmimals.add(new Animal("Bird" , ""));
          nameOfAmimals.add(new Animal("Lion" , ""));
          nameOfAmimals.add(new Animal("Squirrel" , ""));
          nameOfAmimals.add(new Animal("Gray Wolf" , ""));
          nameOfAmimals.add(new Animal("Snake" , ""));
          nameOfAmimals.add(new Animal("Beer" , ""));
          nameOfAmimals.add(new Animal("Deer" , ""));
          nameOfAmimals.add(new Animal("Donkey" , ""));
          nameOfAmimals.add(new Animal("Rhinoceros" , ""));
          nameOfAmimals.add(new Animal("Raccoon" , ""));
          nameOfAmimals.add(new Animal("Rabbit" , ""));
          nameOfAmimals.add(new Animal("Kangaroo" , ""));
          nameOfAmimals.add(new Animal("Koala" , ""));
          nameOfAmimals.add(new Animal("Octopus" , ""));
          nameOfAmimals.add(new Animal("Parrot" , ""));
          nameOfAmimals.add(new Animal("Swan" , ""));
          nameOfAmimals.add(new Animal("Yak" , ""));
          nameOfAmimals.add(new Animal("Zebra" , ""));
  
          AnimalArrayAdapter animalArrayAdapter = new AnimalArrayAdapter(A_Animals.this , nameOfAmimals);
          ListView listView = (ListView) findViewById(R.id.list_view_animals);
          listView.setAdapter(animalArrayAdapter);
  
      }
  }
  </code></pre>