public ArrayIteratorImpl(SalaryManager aggregate) {
    // 在这里先对聚合对象的数据进行过滤,比如工资必须在3000以下
    Collection<PayModel> tempCol = new ArrayList<PayModel>();

    for (PayModel pm : aggregate.getPays()) {
      if (pm.getPay() < 3000) {
        tempCol.add(pm);
      }
    }

    // 然后把符合要求的数据存放到用来迭代的数组
    this.pms = new PayModel[tempCol.size()];
    int i = 0;

    for (PayModel pm : tempCol) {
      this.pms[i] = pm;
      i++;
    }
  }
  public Object next() {
    Object retObj = null;

    if (hasNext()) {
      retObj = pms[index];
      // 每取走一个值,就把已访问索引加1
      index++;
    }

    // 在这里对要返回的数据进行过滤,比如不让查看工资数据
    ((PayModel) retObj).setPay(0.0);

    return retObj;
  }
  /** 计算工资,其实应该有很多参数,为了演示从简 */
  public void calcPay() {
    // 计算工资,并把工资信息填充到工资列表里面
    // 为了测试,做点假数据进去
    PayModel pm1 = new PayModel();
    pm1.setPay(3800);
    pm1.setUserName("张三");

    PayModel pm2 = new PayModel();
    pm2.setPay(5800);
    pm2.setUserName("李四");

    list.add(pm1);
    list.add(pm2);
  }