简体   繁体   English

找出所有组合而不重复第一个元素 - JAVA

[英]Find out all combinations without repeating the first elements - JAVA

I've defined the next ArrayList:我已经定义了下一个 ArrayList:

ArrayList<ArrayList<String>> Elements

When I fill it up it goes like this:当我填满它时,它是这样的:

[[AAA, AAG], [GAA, GAG], [GUA, GUC, GUG, GUU], [UUC, UUU], [GAA, GAG], [CCA, CCC, CCG, CCU], [CAC, CAU], [UAC, UAU], [UAC, UAU]]

I need to generate all possible combinations, starting always with the first position elements of the array, which in this case are: [AAA, AAG].我需要生成所有可能的组合,总是从数组的第一个位置元素开始,在这种情况下是:[AAA, AAG]。

fi:菲:

AAAGAAGUAUUCGAACCACACUACUAC AAAGAAGUAUUCGAACCACACUACUAC

AAAGAAGUAUUCGAACCACACUACUAU AAAGAAGUAUUCGAACCACACUACUAU

AAAGAAGUAUUCGAACCACACUAUUAC AAAGAAGUAUUCGAACCACACUAUUAC

Is there any reason why:是否有任何原因:

1) Set aside the first elements of your array. 1) 将数组的第一个元素放在一边。

2) Generate all combinations of the remainder of your array. 2)生成数组其余部分的所有组合。

3) Add back the first elements to each combination. 3) 将第一个元素添加回每个组合。

Does not solve your problem?没有解决你的问题?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM