title: Need help trying to declare java collections without getting warnings in eclipse
body: <p>I have the following java class which works but I've tried and I can't figure out how to code it correctly to avoid the warnings in eclipse:</p>
  
  <pre><code>import java.util.Collections;
  import java.util.Comparator;
  import java.util.LinkedHashMap;
  import java.util.LinkedList;
  import java.util.List;
  import java.util.Map;
  
  public class test3 {
  
      public static void main(String[] args) {
  
          LinkedHashMap&lt;String, String&gt; myh = new  LinkedHashMap&lt;String, String&gt;();
          myh.put("aa", "lettera");
          myh.put("cc", "letterc");
          myh.put("bb", "letterb");
  
          // this line results in warning one         
          List&lt;String&gt; list = new LinkedList(myh.entrySet());
  
          // this line results in warning two              
          Collections.sort(list, new Comparator() {
              public int compare(Object o1, Object o2) {
                 return ((Comparable) ((Map.Entry) (o1)).getValue())
                    .compareTo(((Map.Entry) (o2)).getValue());
              }
          });
      }
  }
  </code></pre>
  
  <p>warning 1 is: I can't figure out how to get rid of the warning in eclipse "LinkedList is a raw type. References to generic type LinkedList should be parameterized"</p>
  
  <p>Warning 2 is "Type safety: Unchecked invocation sort(List, new Comparator(){}) of the generic method sort(List, Comparator) of type Collections"</p>
  
  <p>Any help will be appreciated!</p>