public static void main(String[] args) {
String a = new String("lo").intern();
final String d = a.intern();
String b = "lo";
final String e = "lo";
String c = "Hello";
System.out.println(b==a);//true
System.out.println(d==a);//true
System.out.println(e==a);//true
System.out.println(c=="Hel"+a); //why is this false? when e==a is true
System.out.println(c=="Hel"+d); //why is this false?
System.out.println(c=="Hel"+b); //why is this false?
System.out.println(c=="Hel"+e); //this is true
}
Run Code Online (Sandbox Code Playgroud)
这导致了
true
true
true
false
false
false
true
Run Code Online (Sandbox Code Playgroud)
表达式e==a为true意味着相同的引用.那么为什么最后一个表达式是真的但是第四个到最后一个表示c== "Hel"+a是假的?
我有一个mysql查询:
select t1.to_step,count(t1.to_step) from tmp t1 left join tmp t3 on
(t1.to_step = t3.from_step and t1.applicant_id=t3.applicant_id)
where t3.to_step is null group by t1.to_step
Run Code Online (Sandbox Code Playgroud)
我试图在使用连接的solr中执行上述操作.我知道像嵌套查询一样加入solr工作但我无法找到一个正确的方法来获取所有记录,因为我从mysql查询中得到.
以下是我正在使用的:
q: "-_query_:\"{!join from=from_step_s to=to_step_s}from_step_s:[* TO *]\"",
Run Code Online (Sandbox Code Playgroud)
这给了我部分结果.基本上我的Solr的文档包含的字段applicant_id,from_step_s以及to_step_s和我想其中从加入该文件to_step_s到from_step_s一组特定的不存在applicant_id.我认为问题出在某处,因为applicant_idsolr查询中没有进行连接(我不知道该怎么做),因为from_step_s一个文档中to_step_s的一个文档与不同的文档匹配applicant_id.