Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有什么方法可以批量处理一个方法,而不是在java中多次调用它_Java_Batch Processing - Fatal编程技术网

有没有什么方法可以批量处理一个方法,而不是在java中多次调用它

有没有什么方法可以批量处理一个方法,而不是在java中多次调用它,java,batch-processing,Java,Batch Processing,我需要多次调用一个方法,我想知道有没有比使用for循环更好的方法来达到这个目的 这是我的密码 for (int i = 0; i < ids.size(); i++) { deleteMessage(currentUser, senderPeerId, messageList.get(i).getId(), contactType, uniqIds.get(i), deleteForAll); } for(int i=0;i{methodCall(I)})不过,使用循环将是很好的

我需要多次调用一个方法,我想知道有没有比使用for循环更好的方法来达到这个目的

这是我的密码

for (int i = 0; i < ids.size(); i++) {
    deleteMessage(currentUser, senderPeerId, messageList.get(i).getId(), contactType, uniqIds.get(i), deleteForAll);
}
for(int i=0;i

我想删除多次调用的消息方法,而不使用for循环,我的意思是类似于批处理实现的东西。。。。你能写一批吗?但是在这个批处理中,你也会使用循环。实际上我不知道如何编写批处理:(为什么你不想使用循环?这基本上就是检查流API的方法,你可以做一些类似于
IntStream.range(0,ids.size()).forEach((I)->{methodCall(I)})不过,使用循环将是很好的,它只是想使用内部迭代器并专注于工作。不,除了使用循环(或并发)之外没有别的方法。考虑重写<代码> DeleMeMeGeEd()/<代码>。也许它正在运行SQL,这样您就可以从消息中执行“代码>删除”,其中ID(批次,ID,这里)