Java 如何从非空列表生成可能的组合
下面是我的示例类Java 如何从非空列表生成可能的组合,java,loops,recursion,combinations,permutation,Java,Loops,Recursion,Combinations,Permutation,下面是我的示例类 public class TuningConfig { private List<String> features; private List<Integer> numberOfTerms; private List<String> importance; public List<String> getFeatures() { return features; }
public class TuningConfig {
private List<String> features;
private List<Integer> numberOfTerms;
private List<String> importance;
public List<String> getFeatures() {
return features;
}
public void setFeatures(List<String> features) {
this.features = features;
}
public List<Integer> getNumberOfTerms() {
return numberOfTerms;
}
public void setNumberOfTerms(List<Integer> numberOfTerms) {
this.numberOfTerms = numberOfTerms;
}
public List<String> getImportance() {
return importance;
}
public void setImportance(List<String> importance) {
this.importance = importance;
}
}
我可能需要另一个类,它将使用组合来存储这些数据(因为它们不是多值的)
有标准的Java库吗
任何帮助都将不胜感激。请分享您尝试过的内容以及您面临的问题。如前所述,我尝试使用嵌套foor循环,但我不确定如何跳过嵌套循环中的非空列表。
{
feature: 'A',
numberOfTerms: 15
},
{
feature: 'A',
numberOfTerms: 25
},
{
feature: 'B',
numberOfTerms: 15
},
{
feature: 'B',
numberOfTerms: 25
}