我正在尝试使用 IPython 运行一个很长的 shell 命令!。如何将命令拆分为多行?
例如,
!awk -v c=0 '{{if (a[$$1]) print $$0 a[$$1]; else if (b[$$2]) print $$0 b[$$2] else {{print $$0 " common_" c; a[$$1] = b[$$2] = " common_" c; c++}}}}' foo.txt | column -t
Run Code Online (Sandbox Code Playgroud)
这样的命令很快就会变得不可读。
我想我可能在Java中发现了一个bug.
我有一个TreeMap,我在其中使用自定义比较器.但是,当我把(键,值)放在已经存在的键上时,它似乎不会覆盖键,从而创建重复的键.我想我已经验证了这一点,因为我尝试过:
System.out.println(testMap.firstKey().equals(testMap.lastKey()));
Run Code Online (Sandbox Code Playgroud)
这打印出真实的.任何人都知道为什么会这样吗?
这是比较器代码:
private class TestComp implements Comparator<String> {
@Override
public int compare(String s1, String s2){
if (s1.equals(s2)) {
return 0;
}
int temp = otherMap.get(s1).compareTo(otherMap.get(s2));
if (temp > 0) {
return 1;
}
return -1;
}
Run Code Online (Sandbox Code Playgroud)