title: I am trying to keep the objects of csv files into a linked list to search for the tshirts But I am getting cannot infer type arguments for linked list
body: <p>My program is to implement a standalone product search program in Java that lists matching
  products for a user who is looking for T-shirts. I am given 3 CSV files. I am trying to keep
  the objects of CSV files into a <code>LinkedList</code> to search for the T-shirts but I am getting <em>cannot
  infer type arguments</em> for <code>LinkedList</code>.
  Here is my code in which I am trying to store objects of CSV file into <code>LinkedList</code>.</p>
  <pre class="lang-java prettyprint-override"><code>package com.example.Mavenassignmentone;
  
  import java.io.*;
  import java.util.*;
  
  public class FindTshirt {
      List&lt;ShirtModel&gt; shirtlist = new LinkedList&lt;ShirtModel&gt;();
      LinkedList&lt;String&gt; list;
      showTshirt sh = new showTshirt();
  
      public void find(String filename, String COLOUR, String GENDER_RECOMMENDATION, String SIZE)
              throws FileNotFoundException {
          Scanner sc = new Scanner(new File(filename));
          while (sc.hasNext()) {
              String sentence = sc.nextLine().toString();
              if (!sentence.isEmpty()) {
                  StringTokenizer token = new StringTokenizer(sentence, &quot;|&quot;);
                  list = new LinkedList&lt;&gt;(sentence.length());
                  while (token.hasMoreTokens()) {
                      list.add(token.nextToken());
                  }
                  if (list.get(1).equals(COLOUR) &amp;&amp; list.get(2).equals(GENDER_RECOMMENDATION)
                          &amp;&amp; list.get(3).equals(SIZE)) {
                      ShirtModel model = new ShirtModel(list.get(0), list.get(1), list.get(2),
                              list.get(3), list.get(4), Integer.parseInt(list.get(5)),
                              Float.parseFloat(list.get(6)), list.get(7));
                      shirtlist.add(model);
                  }
              }
          }
      }
  
      public void updateView(int choiceCode) {
          if (choiceCode == 1) {
              Collections.sort(shirtlist, new Comparator&lt;ShirtModel&gt;() {
                  @Override
                  public int compare(ShirtModel o1, ShirtModel o2) {
                      return o1.getPrice() - o2.getPrice();
                  }
              });
          }
          else if (choiceCode == 2) {
              Collections.sort(shirtlist, new Comparator&lt;ShirtModel&gt;() {
                  public int compare(ShirtModel o1, ShirtModel o2) {
                      return (int) (o1.getRating() - o2.getRating());
                  }
              });
          }
  
          else {
              System.out.println(&quot;Wrong Choice.&quot;);
              return;
          }
          sh.viewtshirt(shirtlist);
      }
  }
  </code></pre>
  <p>This line of code is giving error:</p>
  <pre class="lang-java prettyprint-override"><code>list=new LinkedList&lt;&gt;(sentence.length());
  </code></pre>
  <p>Error is</p>
  <blockquote>
  <p>cannot infer type arguments</p>
  </blockquote>