gpt4 book ai didi

java - 一个数组列表可以容纳多少个字符串?

转载 作者:行者123 更新时间:2023-12-01 21:59:39 28 4
gpt4 key购买 nike

我正在尝试编写一个网络爬虫。当我浏览一个大页面时,我的 arraylist 变量无法保存所有数据。它抛出以下异常。线程“Thread-0”java.lang.StackOverflowError”中出现异常。

保存这些网址的最佳方式是什么,因为我需要访问这些网址和子网址等。

我想过保存到数据库或写入文件,但这些机制可能会降低爬虫的性能。

最佳答案

when I am going through a large page my arraylist variable is not able to hold all the data

这是不正确的。

Exception in thread "Thread-0" java.lang.StackOverflowError

StackOverflowException 不是由于耗尽 ArrayList 容量(即 2^31-1 条目)而引起的。这是由于过度递归造成的。

您可能没有跟踪已访问过的网址,并且遇到了链接周期。

关于java - 一个数组列表可以容纳多少个字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33796040/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com