如何有条理地遍历链接的HashSet并获得结果
Given set A = {A, B, C};
Given Set B = {D, E, F}; <- Keeping this set unchanged
按顺序迭代,
node A ->
if(! Some condition) {
skip node A and Goto B;
}else{
{D, E, F,A}, {D, E, F, A,B}, {D,E,F,A,C};
}
node B ->
if(! Some condition) {
skip node B and Goto C;
} else{
{D, E, F,B}, {D, E, F,B,C}
}
node C ->
if(! Some condition) {
exit;
}else{
{D, E, F,C}
}
结果就是,
{D, E, F, A}
{D, E, F, A, B}
{D, E, F, A, C}
{D, E, F, B}
{D, E, F, B, C}
{D, E, F, C}
{D, E, F, A, B, C}