我正在从事 j2me 项目,该项目涉及从在线数据库中获取用户列表,然后我打算用用户名填充一个列表,并且数量可能非常大。我的问题是 - 您可以附加到列表的项目数量是否有限制?
HttpConnection hc = (HttpConnection);
String reply;
Connector.open("http://www.xxxxxxxxxxxx.com/......?xx=xx");
InputStream is = new hc.openInputStream();
int ch;
// Check the Content-Length first
long len = hc.getLength();
if(len!=-1) {
for(int i = 0;i<len;i++)
if((ch = is.read())!= -1)
reply += (char) ch;
} else {
// if the content-length is not available
while ((ch = is.read()) != -1)
reply += (char) ch;
}
is.close();
hc.close();
DataParser parser = new DataParser(reply); // This is a custom class I created to process the XML data returned from the server to split it into groups and put in an array.
List user list = new List("Users");
if (parser.moveToNext()) {
do {
list.append(parser.get(), null);
}
}
这段代码似乎工作正常,但我的问题是,如果继续调用 list.append("", null),它是否会在抛出一些异常时达到某个点,也许是在 50,000 个名称(列表项)的情况下?