私はセットの交差点で労働組合にセットのコレクションを必要とし、ここでは、そのような署名で交差点の集合をフィルタリングする方法は?
Collection<Set<Integer>> filter(Collection<Set<Integer>> collection);
を関数を記述は、この例では、そのセットを見ることができますセット
1) {1,2,3}
2) {4}
3) {1,5}
4) {4,7}
5) {3,5}
の簡単な例であります1
,3
、および5
が交差する。それを新しいセット{1,2,3,5}
として書き直すことができます。また、交差を持つ2つのセットもあります。それらは2
と4
であり、新しいセット{4,7}
を作成できます。出力結果は、{1,2,3,5}
と{4,7}
の2つのセットのコレクションになります。
このタスクのどの時点から解決するのか分かりません。
あなたは最終的な出力がどうあるべきか、より具体的なことはできますか?パワーセット? – ketrox
確かに。これは2つの集合( '{1,2,3,5}'と '{4,7}')の集合でなければなりません。 – Mark
@ketrox任意のセットの威力はランダムになる可能性があります。 – Mark