JAva再帰戻り
375 ワード
private Integer getAvailableQuestionId(String totalIdsKey,String answeredKey){
// id
Set availableIds = Redis.use().sdiff(totalIdsKey, answeredKey);
if (availableIds.size()==0) {
Redis.use().del(answeredKey);
return getAvailableQuestionId(totalIdsKey,answeredKey);
}
return (Integer) availableIds.iterator().next();
}