title: How to sort a List<Object> alphabetically using Object name field
body: <p>I have a List of Objects like <code>List&lt;Object&gt; p</code>.I want to sort this list alphabetically using Object name field. Object contains 10 field and name field is one of them.</p>
  
  <pre><code>if (list.size() &gt; 0) {
      Collections.sort(list, new Comparator&lt;Campaign&gt;() {
          @Override
          public int compare(final Object object1, final Object object2) {
          return String.compare(object1.getName(), object2.getName());
          }
      } );
  }
  </code></pre>
  
  <p>But there is nothing like String.compare..?</p>