JAVA 去重List 重复目标ITeye - AG环亚娱乐集团

JAVA 去重List 重复目标ITeye

2019-01-11 12:46:52 | 作者: 运鸿 | 标签: 目标,重复,前端 | 浏览: 1057

/**
  * 去重前端传来的参数 userOthers-- 用户目标防止数据库目标主键重复
  * @param userOthers
  * @return List MeetingAppOtherUserCommand
  * 2016-11-21
  * List MeetingAppOtherUserCommand
  */
  public static List MeetingAppOtherUserCommand tarnsMeetingAppOtherUserCommand(List MeetingAppOtherUserCommand userOthers){
  Set setWorknumber = new HashSet();
  List MeetingAppOtherUserCommand newUsers = new ArrayList MeetingAppOtherUserCommand
  //当数据目标没有回来原有目标
  if(userOthers == null || userOthers.size() ==0){
  return userOthers;
  }
  System.out.println(" userOthers----size--:"+userOthers.size()+"----");
  for(MeetingAppOtherUserCommand meetingAppOtherUserCommand: userOthers){
  if(setWorknumber.add(meetingAppOtherUserCommand.getWorkNumber())){
  newUsers.add(meetingAppOtherUserCommand);
  }else{
  System.out.println(" MeetingAppOtherUserCommand----有重复目标---:"+meetingAppOtherUserCommand.getWorkNumber()+"----");
  }
  }
  System.out.println(" newUsers----size---:"+newUsers.size()+"----");
  return newUsers;
  }
 
  public static void main(String[] args) {
  System.out.println("  -- tarnsMeetingAppOtherUserCommand ----");
  List MeetingAppOtherUserCommand users = new ArrayList MeetingAppOtherUserCommand
  MeetingAppOtherUserCommand user1 = new MeetingAppOtherUserCommand();
 
  user1.setWorkNumber("000001");
  user1.setGivenSign("Y");
  users.add(user1);
  users.add(user1);
  MeetingAppOtherUserCommand user2 = new MeetingAppOtherUserCommand();
 
  user2.setWorkNumber("000002");
  user2.setGivenSign("Y");
  users.add(user2);
  users.add(user2);
  MeetingAppOtherUserCommand user3 = new MeetingAppOtherUserCommand();
 
  user3.setWorkNumber("000002");
  user3.setGivenSign("Y");
  users.add(user3);
  //List MeetingAppOtherUserCommand users = new ArrayList MeetingAppOtherUserCommand
  //List MeetingAppOtherUserCommand newUsers = tarnsMeetingAppOtherUserCommand(users);
  users = tarnsMeetingAppOtherUserCommand(users);
}
版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表AG环亚娱乐集团立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章

阅读排行

  • 1

    vba upgradeITeye

    文件,程序,晋级
  • 2

    java 多线程ITeye

    线程,作业,内存
  • 3
  • 4

    ClassLoaderITeye

    运用,文件,办法
  • 5
  • 6

    手机号码校验合法性ITeye

    代表,必定,第二位
  • 7
  • 8

    Java 目标巨细的核算ITeye

    目标,巨细,字节
  • 9
  • 10