solr中的NamedList问题
在这里,我在下面添加了代码,其中包含 ArrayList ,其中包含值,然后我将该值添加到我的命名列表中
NamedList final1 = null;
NamedList<ArrayList<String>> result = null;
ArrayList<String> data=\\ It has values
result.add("Gender",data);
ArrayList<String> data1=\\ It has values
result.add("Group ID",data1);
final1.add("Query",result);
,但代码不起作用。我不知道为什么这段代码不起作用。任何人都可以指导我吗?
提前致谢
Here i had added code below in which i had ArrayList Which contains values and then i am adding that values to my named list
NamedList final1 = null;
NamedList<ArrayList<String>> result = null;
ArrayList<String> data=\\ It has values
result.add("Gender",data);
ArrayList<String> data1=\\ It has values
result.add("Group ID",data1);
final1.add("Query",result);
But the code is not working. I don't know why this code is not working. CAN Any one guide me.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将
final1
声明为null
并且在使用它之前没有对其进行初始化。因此,当代码
执行时,它会抛出一个 NullPointerException 异常。
要解决此问题,您应该在使用
final1
之前对其进行初始化。像这样的东西:You declared
final1
to benull
and didn't initialize it before using it.So, when the code:
executes, it throws a
NullPointerException
.To fix this, you should initialize
final1
before using it. Something like: