提交修改
This commit is contained in:
parent
da76455a9e
commit
f79a76f13a
@ -362,25 +362,24 @@ public class AdminProductController {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String a[] = new String[]{"a","b","c"}; // 颜色
|
||||
String b[] = new String[]{"x","y","z"}; // 长度
|
||||
String a[] = new String[]{"a","c","f"}; // 颜色
|
||||
String b[] = new String[]{"x","z","y"}; // 长度
|
||||
String c[] = new String[]{"m","n"}; // 尺寸
|
||||
String d[] = new String[]{"0","1"}; // 尺寸
|
||||
|
||||
List<String[]> list =new ArrayList<>();
|
||||
|
||||
list.add(a);
|
||||
list.add(b);
|
||||
list.add(c);
|
||||
list.add(d);
|
||||
|
||||
|
||||
int size = list.size();
|
||||
List<Integer> level = new ArrayList<>();
|
||||
for (String[] strings : list) {
|
||||
level.add(strings.length);
|
||||
}
|
||||
|
||||
System.out.println(JSON.toJSONString(level));
|
||||
|
||||
List<List<Integer>> ccc = can(level);
|
||||
System.out.println(JSON.toJSONString(ccc));
|
||||
|
||||
@ -390,46 +389,54 @@ public class AdminProductController {
|
||||
for (List<Integer> integers : ccc) {
|
||||
ddd = digui(integers,ddd,i );
|
||||
i ++;
|
||||
|
||||
}
|
||||
|
||||
System.out.println(JSON.toJSONString(ddd));
|
||||
System.out.println(ddd.size());
|
||||
|
||||
|
||||
System.out.println(JSON.toJSONString(list));
|
||||
|
||||
for (List<Integer> integers : ddd) {
|
||||
|
||||
System.out.println(getValue(list,integers));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getValue( List<String[]> list, List<Integer> index){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0 ;i < list.size() ; i++) {
|
||||
String[] strings = list.get(i);
|
||||
sb.append(strings[index.get(i)]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static List<List<Integer>> digui(List<Integer> list, List<List<Integer>> ddd,int flag ){
|
||||
List<List<Integer>> newList = new ArrayList<>();
|
||||
if(ddd.size()==0){
|
||||
newList.add(list);
|
||||
for (Integer i : list) {
|
||||
List<Integer> item = new ArrayList<>();
|
||||
item.add(i);
|
||||
newList.add(item);
|
||||
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
if(flag ==2){
|
||||
System.out.println("xxxxxxxxxx");
|
||||
}
|
||||
|
||||
for (List<Integer> integers : ddd) {
|
||||
for (Integer integer : integers) {
|
||||
for (Integer i : list) {
|
||||
List<Integer> listItem = new ArrayList<>();
|
||||
listItem.addAll(integers );
|
||||
listItem.add(i);
|
||||
newList.add(listItem);
|
||||
}
|
||||
for (Integer i : list) {
|
||||
List<Integer> listItem = new ArrayList<>();
|
||||
listItem.addAll(integers);
|
||||
listItem.add(i);
|
||||
newList.add(listItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return newList;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<List<Integer>> can (List<Integer> list ){
|
||||
List<List<Integer>> lists = new ArrayList<>();
|
||||
for (Integer i : list) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user