add Stream utils

This commit is contained in:
Looly
2021-06-07 18:46:24 +08:00
parent 6a76d260fe
commit b0e62df7c6
6 changed files with 291 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
package cn.hutool.core.stream;
import org.junit.Assert;
import org.junit.Test;
import java.util.stream.Stream;
public class StreamUtilTest {
@Test
public void ofTest(){
final Stream<Integer> stream = StreamUtil.of(2, x -> x * 2, 4);
final String result = stream.collect(CollectorUtil.joining(","));
Assert.assertEquals("2,4,8,16", result);
}
}