title: Comparable type Sorting in a Vector int or String
body: <p>In this I am trying to sort out the intV and stringV using this getSmallestValue method. Tried different ideas but does not seems to be working. Anyone have any bright ideas how to implement this getSmallestValue method?</p>
  
  <pre><code>public class test {
  
      public static Comparable getSmallestValue(Vector&lt;Comparable&gt; a) {
          Comparator com = Collections.reverseOrder();
          Collections.sort(a, com);
          return (Comparable) a;
      }
  
      public static void main(String[] args) {
          Vector&lt;Comparable&gt; intV = new Vector&lt;Comparable&gt;();
          intV.add(new Integer(-1));
          intV.add(new Integer(56));
          intV.add(new Integer(-100));
          int smallestInt = (Integer) getSmallestValue(intV);
  
          System.out.println(smallestInt);
  
          Vector&lt;Comparable&gt; stringV = new Vector&lt;Comparable&gt;();
          stringV.add("testing");
          stringV.add("Pti");
          stringV.add("semesterGoes");
          String smallestString = (String) getSmallestValue(stringV);
  
          System.out.println(smallestString);
      }
  }
  </code></pre>