:trollface: 去掉transform

This commit is contained in:
VampireAchao 2022-10-18 10:36:40 +08:00
parent a191a3874f
commit fa089a2a67
3 changed files with 2 additions and 27 deletions

View File

@ -289,18 +289,6 @@ public interface TerminableWrappedStream<T, S extends TerminableWrappedStream<T,
// region ============ to optional ============
/**
* 将当前流转为另一对象用于提供针对流本身而非流中元素的操作
*
* @param <R> 转换类型
* @param transform 转换
* @return 转换后的流
*/
default <R> Optional<R> transform(final Function<? super S, R> transform) {
Objects.requireNonNull(transform);
return Optional.ofNullable(transform.apply(wrap(this)));
}
/**
* 获取与给定断言匹配的第一个元素
*

View File

@ -97,12 +97,6 @@ public class AbstractEnhancedWrappedStreamTest {
}, toZip);
}
@Test
public void testTransform() {
final List<Integer> list = wrap(1, 2, 3).transform(Wrapper::toList).orElse(null);
Assert.assertEquals(asList(1, 2, 3), list);
}
@Test
public void testFindFirst() {
final List<Integer> list = asList(1, 2, 3);
@ -181,6 +175,7 @@ public class AbstractEnhancedWrappedStreamTest {
final List<Integer> list = asList(1, 2, 3);
final Map<Boolean, List<Integer>> map = new HashMap<Boolean, List<Integer>>() {
private static final long serialVersionUID = 1L;
{
put(Boolean.TRUE, singletonList(2));
put(Boolean.FALSE, asList(1, 3));
@ -624,6 +619,7 @@ public class AbstractEnhancedWrappedStreamTest {
public void testToEntries() {
final Map<Integer, Integer> expect = new HashMap<Integer, Integer>() {
private static final long serialVersionUID = 1L;
{
put(1, 1);
put(2, 2);

View File

@ -556,13 +556,4 @@ public class EasyStreamTest {
}
}
@Test
public void testTransform() {
final boolean result = EasyStream.of(1, 2, 3)
.transform(EasyStream::toList)
.map(List::isEmpty)
.orElse(false);
Assert.assertFalse(result);
}
}