我有要并行处理的元素集合.当我使用a时List,并行性有效.但是,当我使用a时Set,它并不是并行运行的.
我写了一个显示问题的代码示例:
public static void main(String[] args) {
ParallelTest test = new ParallelTest();
List<Integer> list = Arrays.asList(1,2);
Set<Integer> set = new HashSet<>(list);
ForkJoinPool forkJoinPool = new ForkJoinPool(4);
System.out.println("set print");
try {
forkJoinPool.submit(() ->
set.parallelStream().forEach(test::print)
).get();
} catch (Exception e) {
return;
}
System.out.println("\n\nlist print");
try {
forkJoinPool.submit(() ->
list.parallelStream().forEach(test::print)
).get();
} catch (Exception e) {
return;
}
}
private void print(int i){
System.out.println("start: " + i);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
}
System.out.println("end: …Run Code Online (Sandbox Code Playgroud) 在 ios 13 上 PHImageManagerMaximumSize 不起作用。
打电话时
let manager = PHImageManager.default()
let option = PHImageRequestOptions()
option.isSynchronous = synchronous
option.isNetworkAccessAllowed = true
option.resizeMode = .exact
manager.requestImage(for: asset, targetSize: PHImageManagerMaximumSize, contentMode: .aspectFill, options: option, resultHandler: {(result, info) in
})
Run Code Online (Sandbox Code Playgroud)
requestImage 返回错误:Error Domain=NSCocoaErrorDomain Code=-1 "(null)"
此代码在 ios12 上运行良好
你能告诉我如何在ios13上获取原始图像吗?