java.util.NoSuchElementException解决办法

源代码:

Iterator it = jedis.smembers(key).iterator();

while(it.hasNext()){

if(null==twoValue || twoValue.equals("") || it.next().indexOf("twovalue") !=-1){

     resList.add(new RedisVo(it.next()));

}

}

修改过后的代码:

Iterator it = jedis.smembers(key).iterator();

while(it.hasNext()){

 String tempValue = it.next();

if(null==twoValue || twoValue.equals("") || twoValue.indexOf("twovalue") !=-1){

     resList.add(new RedisVo(tempValue));

}

}

你可能感兴趣的:(java)