Merge branch 'v6-dev' of gitee.com:dromara/hutool into v6-dev

Signed-off-by: 阿超 <achao1441470436@gmail.com>
This commit is contained in:
阿超 2022-10-18 01:54:15 +00:00 committed by Gitee
commit a191a3874f
4 changed files with 14 additions and 4 deletions

View File

@ -188,6 +188,8 @@ public class FileTypeUtil {
typeName = "doc"; typeName = "doc";
} else if ("msi".equalsIgnoreCase(extName)) { } else if ("msi".equalsIgnoreCase(extName)) {
typeName = "msi"; typeName = "msi";
} else if ("ppt".equalsIgnoreCase(extName)) {
typeName = "ppt";
} }
} else if ("zip".equals(typeName)) { } else if ("zip".equals(typeName)) {
// zip可能为docxxlsxpptxjarwarofd等格式扩展名辅助判断 // zip可能为docxxlsxpptxjarwarofd等格式扩展名辅助判断

View File

@ -40,6 +40,7 @@ import java.util.stream.StreamSupport;
* </ul> * </ul>
* 不同类型的流可以通过{@link #sequential()}{@link #parallel()}互相转换 * 不同类型的流可以通过{@link #sequential()}{@link #parallel()}互相转换
* *
* @param <T> 对象类型
* @author VampireAchao * @author VampireAchao
* @author emptypoint * @author emptypoint
* @author huangchengxing * @author huangchengxing

View File

@ -32,6 +32,11 @@ import static java.util.Objects.requireNonNull;
*/ */
public class StreamUtil { public class StreamUtil {
/**
* @param array 数组
* @param <T> 元素类型
* @return {@link Stream}
*/
@SafeVarargs @SafeVarargs
public static <T> Stream<T> of(final T... array) { public static <T> Stream<T> of(final T... array) {
Assert.notNull(array, "Array must be not null!"); Assert.notNull(array, "Array must be not null!");
@ -66,8 +71,9 @@ public class StreamUtil {
/** /**
* {@link Iterator} 转换为 {@link Stream} * {@link Iterator} 转换为 {@link Stream}
*
* @param iterator 迭代器 * @param iterator 迭代器
* @param <T> 集合元素类型 * @param <T> 集合元素类型
* @return {@link Stream} * @return {@link Stream}
* @throws IllegalArgumentException 如果iterator为null抛出该异常 * @throws IllegalArgumentException 如果iterator为null抛出该异常
*/ */
@ -77,9 +83,10 @@ public class StreamUtil {
/** /**
* {@link Iterator} 转换为 {@link Stream} * {@link Iterator} 转换为 {@link Stream}
*
* @param iterator 迭代器 * @param iterator 迭代器
* @param parallel 是否并行 * @param parallel 是否并行
* @param <T> 集合元素类型 * @param <T> 集合元素类型
* @return {@link Stream} * @return {@link Stream}
* @throws IllegalArgumentException 如果iterator为null抛出该异常 * @throws IllegalArgumentException 如果iterator为null抛出该异常
*/ */

View File

@ -42,8 +42,8 @@ public interface TransformableWrappedStream<T, S extends TransformableWrappedStr
final Iterable<U> other, final Iterable<U> other,
final BiFunction<? super T, ? super U, ? extends R> zipper) { final BiFunction<? super T, ? super U, ? extends R> zipper) {
Objects.requireNonNull(zipper); Objects.requireNonNull(zipper);
Map<Integer, T> idxIdentityMap = 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());
Map<Integer, U> idxOtherMap = EasyStream.of(other).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()) { if (idxIdentityMap.size() <= idxOtherMap.size()) {
return EasyStream.of(idxIdentityMap.keySet(), isParallel()).map(k -> zipper.apply(idxIdentityMap.get(k), idxOtherMap.get(k))); return EasyStream.of(idxIdentityMap.keySet(), isParallel()).map(k -> zipper.apply(idxIdentityMap.get(k), idxOtherMap.get(k)));
} }