我有兩套說:拼接元素
ImmutableSet<String> firstSet = ImmutableSet.of("1","2","3");
ImmutableSet<String> secondSet = ImmutableSet.of("a","b","c");
我想獲得一組包括與每個第二的元素連接在一起的第一組元素,用分隔符即輸出一起應該是:
ImmutableSet<String> thirdSet = ImmutableSet.of("1.a","1.b","1.c","2.a","2.b","2.c","2.c","3.a","3.b","3.c");
我最初以爲我能做到這一點通過流的第一組(這是我的分隔符「」)並在第二個元素上應用Collectors.joining()
,但這並不能解決我的需求。