mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
Merge branch 'v6-dev' of gitee.com:dromara/hutool into v6-dev
Signed-off-by: 阿超 <achao1441470436@gmail.com>
This commit is contained in:
commit
a191a3874f
@ -188,6 +188,8 @@ public class FileTypeUtil {
|
||||
typeName = "doc";
|
||||
} else if ("msi".equalsIgnoreCase(extName)) {
|
||||
typeName = "msi";
|
||||
} else if ("ppt".equalsIgnoreCase(extName)) {
|
||||
typeName = "ppt";
|
||||
}
|
||||
} else if ("zip".equals(typeName)) {
|
||||
// zip可能为docx、xlsx、pptx、jar、war、ofd等格式,扩展名辅助判断
|
||||
|
@ -40,6 +40,7 @@ import java.util.stream.StreamSupport;
|
||||
* </ul>
|
||||
* 不同类型的流可以通过{@link #sequential()}或{@link #parallel()}互相转换。
|
||||
*
|
||||
* @param <T> 对象类型
|
||||
* @author VampireAchao
|
||||
* @author emptypoint
|
||||
* @author huangchengxing
|
||||
|
@ -32,6 +32,11 @@ import static java.util.Objects.requireNonNull;
|
||||
*/
|
||||
public class StreamUtil {
|
||||
|
||||
/**
|
||||
* @param array 数组
|
||||
* @param <T> 元素类型
|
||||
* @return {@link Stream}
|
||||
*/
|
||||
@SafeVarargs
|
||||
public static <T> Stream<T> of(final T... array) {
|
||||
Assert.notNull(array, "Array must be not null!");
|
||||
@ -66,8 +71,9 @@ public class StreamUtil {
|
||||
|
||||
/**
|
||||
* {@link Iterator} 转换为 {@link Stream}
|
||||
*
|
||||
* @param iterator 迭代器
|
||||
* @param <T> 集合元素类型
|
||||
* @param <T> 集合元素类型
|
||||
* @return {@link Stream}
|
||||
* @throws IllegalArgumentException 如果iterator为null,抛出该异常
|
||||
*/
|
||||
@ -77,9 +83,10 @@ public class StreamUtil {
|
||||
|
||||
/**
|
||||
* {@link Iterator} 转换为 {@link Stream}
|
||||
*
|
||||
* @param iterator 迭代器
|
||||
* @param parallel 是否并行
|
||||
* @param <T> 集合元素类型
|
||||
* @param <T> 集合元素类型
|
||||
* @return {@link Stream}
|
||||
* @throws IllegalArgumentException 如果iterator为null,抛出该异常
|
||||
*/
|
||||
|
@ -42,8 +42,8 @@ public interface TransformableWrappedStream<T, S extends TransformableWrappedStr
|
||||
final Iterable<U> other,
|
||||
final BiFunction<? super T, ? super U, ? extends R> zipper) {
|
||||
Objects.requireNonNull(zipper);
|
||||
Map<Integer, T> idxIdentityMap = mapIdx((e, idx) -> MapUtil.entry(idx, e)).collect(CollectorUtil.entryToMap());
|
||||
Map<Integer, U> idxOtherMap = EasyStream.of(other).mapIdx((e, idx) -> MapUtil.entry(idx, e)).collect(CollectorUtil.entryToMap());
|
||||
final Map<Integer, T> idxIdentityMap = mapIdx((e, idx) -> MapUtil.entry(idx, e)).collect(CollectorUtil.entryToMap());
|
||||
final Map<Integer, U> idxOtherMap = EasyStream.of(other).mapIdx((e, idx) -> MapUtil.entry(idx, e)).collect(CollectorUtil.entryToMap());
|
||||
if (idxIdentityMap.size() <= idxOtherMap.size()) {
|
||||
return EasyStream.of(idxIdentityMap.keySet(), isParallel()).map(k -> zipper.apply(idxIdentityMap.get(k), idxOtherMap.get(k)));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user