我怎么assertThat样null?
例如
assertThat(attr.getValue(), is(""));
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误,说我不能null进去is(null).
我的代码导致错误,我不知道如何修复它。我尝试输入打印语句,但它甚至无法做到那么远。出现错误
这是确切的错误
java.util.ConcurrentModificationException
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:894)
at java.util.HashMap$KeyIterator.next(HashMap.java:928)
at ca.on.oicr.pinery.lims.gsle.GsleClient.getOrders(GsleClient.java:720)
Run Code Online (Sandbox Code Playgroud)
第720行是第二个for循环
我指的是以下内容:
https://code.google.com/p/guava-libraries/wiki/CachesExplained
我有一个哈希映射,目前定义如下:
Map<String, String> barcodeMap = Maps.newHashMap(); //Declaring hashmap
while ((nextLine = reader.readNext()) != null) // populating hashmap
{
barcodeMap.put(nextLine[0], nextLine[1]);
}
Run Code Online (Sandbox Code Playgroud)
我希望我的地图用缓存实现,它一次只存储两个小时,我试着阅读我放的链接中的例子,但我不明白我将如何更改当前的地图.我明白我必须填充地图然后使用驱逐,但我不明白我将如何更改我当前的代码.
我知道还有其他页面,但我想让自己的工作,我不知道为什么它不起作用.我是node.js的新手.
for (var index in output)
{
if (opt.options.showEmpty != true)
{
var check = arrayIsEmpty(output[index]);
if ( check == true )
{
continue;
}
else
{
var array = removingEmptyString(output[index]);
console.log(index + "\t" + array);
//console.log(index+ "\t" + output[index]);
}
}
}
function removingEmptyString(array)
{
var newArray;
for( var i = 0; i < array.length; i++)
{
if(array[i] != "" || array[i] != null)
{
newArray[i] = array[i];
}
}
return newArray;
}
Run Code Online (Sandbox Code Playgroud)
我的结果是树,,,我以前在我写的代码之前得到了.现在我得到一个错误
newArray[i] = array[i];
^
TypeError: …Run Code Online (Sandbox Code Playgroud) 我创建了这个新集,并希望将项添加到集合中.但它不会进入循环.我尝试运行该程序,它不会显示在for循环中.我不确定hwy或如何更改代码以使其工作.
Set<Name> names = Sets.newHashSet();
for (Name n : names) {
System.out.println("in the for loop");
n.setName("Tom);
}
Run Code Online (Sandbox Code Playgroud)