add StrJoiner

This commit is contained in:
Looly
2021-06-17 20:41:01 +08:00
parent 757bfdc723
commit 40a14e1508
6 changed files with 268 additions and 20 deletions

View File

@@ -37,6 +37,13 @@ public class IterUtilTest {
Assert.assertEquals("\"1\":\"2\":\"3\":\"4\"", join2);
}
@Test
public void joinWithFuncTest() {
ArrayList<String> list = CollUtil.newArrayList("1", "2", "3", "4");
String join = IterUtil.join(list.iterator(), ":", String::valueOf);
Assert.assertEquals("1:2:3:4", join);
}
@Test
public void testToListMap() {
Map<String, List<String>> expectedMap = new HashMap<>();