static List<String> cartesianProduct(List<String> xList,List<String> yList,boolean isSuffix){
  List<String> product=new ArrayList<String>();
  for (  String x : xList) {
    for (    String y : yList) {
      product.add(x + y);
    }
  }
  removeDuplicateAffix(product,isSuffix);
  return product;
}

static List < String > cartesianProduct ( List < String > xList , List < String > yList , boolean isSuffix ) { List < String > product = new ArrayList < String > ( ) ; for ( String x : xList ) { for ( String y : yList ) { product . add ( x + y ) ; } } removeDuplicateAffix ( product , isSuffix ) ; return product ; }
this function calculates the cartesian product of two string lists ( treated as set ) , and removes the duplicates in the results . for example , for xlist = { " ab " , " a " } , ylist = { " bc " , " c " } , the cartesian product is { " abbc " , " abc " , " abc " , " ac " } . after removing duplicates , { " abbc " , " abc " , " ac " } is returned
