gistfile1.txt // 三个奖励是否为存在重复获奖用户, 有则取最高奖励的那个奖励Map rewardMap = new HashMap (3); ActivityNovReward[] rewardArray = {firstReward,lastReward,maxReward}; ActivityNovReward activityNovReward
// 三个奖励是否为存在重复获奖用户, 有则取最高奖励的那个奖励 MaprewardMap = new HashMap (3); ActivityNovReward[] rewardArray = {firstReward,lastReward,maxReward}; ActivityNovReward activityNovReward = null ; for(ActivityNovReward reward :rewardArray ){ if(reward == null){ continue; } activityNovReward = rewardMap.get(reward.getUserId()); if(activityNovReward != null){ //存在重复奖励, reward 和 activityNovReward 的用户id 是一样的 if(reward.getRewardAmt().compareTo(activityNovReward.getRewardAmt()) == 1){ // reward 奖励 大于 activityNovReward , 用户 reward 覆盖掉 activityNovReward rewardMap.put(reward.getUserId(), reward); } }else{ rewardMap.put(reward.getUserId(), reward); } }