title: How can I read and remove elements from a List<List<T>>?
body: <p>I've obtained a list of lists from the cartesian product and now I need to remove all the elements that repeat 2 times the same letter and one of the elements that contain the same 2 letters in different order (gg, sg, gs)
  here's my code:</p>
  <pre class="lang-java prettyprint-override"><code>import java.util.*;
  import com.google.common.collect.*;
  
  public class partite {
  
      public static void main(String[] args) {
          String[] nomi = { &quot;G&quot;, &quot;S&quot;, &quot;R&quot; };
          List&lt;List&lt;String&gt;&gt; player = giocatori(nomi);
          System.out.println(player);
      }
  
      public static List&lt;List&lt;String&gt;&gt; giocatori(String[] players) {
          ArrayList&lt;String&gt; comb = new ArrayList&lt;String&gt;();
          for (int i = 0; i &lt; players.length; i++) {
              comb.add(players[i]);
          }
  
          List&lt;List&lt;String&gt;&gt; list = Lists.cartesianProduct(comb, comb);
          return list;
      }
  }
  </code></pre>