Merge two collections of accumulators. The second will be merged into the
first.

@param target
The collection of accumulators that will be updated
@param toMerge
The collection of accumulators that will be merged into the
other
971433
public static void mergeInto(Map<String, Accumulator<?, ?>> target, Map<String, Accumulator<?, ?>> toMerge) {
		for (Map.Entry<String, Accumulator<?, ?>> otherEntry : toMerge.entrySet()) {
			Accumulator<?, ?> ownAccumulator = target.get(otherEntry.getKey());
			if (ownAccumulator == null) {
				// Take over counter from chained task
				target.put(otherEntry.getKey(), otherEntry.getValue());
			} else {
				// Both should have the same type
				AccumulatorHelper.compareAccumulatorTypes(otherEntry.getKey(),
						ownAccumulator.getClass(), otherEntry.getValue().getClass());
				// Merge counter from chained task into counter from stub
				mergeSingle(ownAccumulator, otherEntry.getValue());
			}
		}
	}
30612
private void mergeRows(ExcelRows excelRowsAnn, Cell templateCell, int itemSize) {
        val tmplCellRowIndex = templateCell.getRowIndex();

        for (val ann : excelRowsAnn.mergeRows()) {
            val fr = ann.fromRef();
            val cellRef = PoiUtil.isFullCellReference(fr) ? fr : fr + (tmplCellRowIndex + 1);
            val fromCell = PoiUtil.findCell(sheet, cellRef);

            val lastRow = tmplCellRowIndex + itemSize - 1;
            if (ann.type() == MergeType.Direct) {
                val fromRow = fromCell.getRow().getRowNum();
                directMergeRows(ann, fromRow, lastRow, fromCell.getColumnIndex());
            } else if (ann.type() == MergeType.SameValue) {
                sameValueMergeRows(ann, itemSize, fromCell);
            }
        }
    }
516146
@Override
  public void merge(MtasDataCollector<?, ?> newDataCollector,
      Map<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map,
      boolean increaseSourceNumber) throws IOException {
    closeNewList();
    if (!collectorType.equals(newDataCollector.getCollectorType())
        || !dataType.equals(newDataCollector.getDataType())
        || !statsType.equals(newDataCollector.getStatsType())
        || !(newDataCollector instanceof MtasDataFull)) {
      throw new IOException("cannot merge different dataCollectors");
    } else {
      segmentRegistration = null;
      @SuppressWarnings("unchecked")
      MtasDataFull<T1, T2> newMtasDataFull = (MtasDataFull<T1, T2>) newDataCollector;
      closeNewList();
      initNewList(newMtasDataFull.getSize());
      if (collectorType.equals(DataCollector.COLLECTOR_TYPE_LIST)) {
        map.put(newDataCollector, this);
        for (int i = 0; i < newMtasDataFull.getSize(); i++) {
          if (newMtasDataFull.fullValueList[i].length > 0) {
            MtasDataCollector<?, ?>[] subCollectors = new MtasDataCollector<?, ?>[1];
            subCollectors[0] = add(newMtasDataFull.keyList[i],
                increaseSourceNumber);
            setError(newCurrentPosition, newMtasDataFull.errorNumber[i],
                newMtasDataFull.errorList[i], newCurrentExisting);
            setValue(newCurrentPosition, newMtasDataFull.fullValueList[i],
                newMtasDataFull.fullValueList[i].length, newCurrentExisting);
            if (hasSub() && newMtasDataFull.hasSub()) {
              // single key implies exactly one subCollector if hasSub
              subCollectors[0].merge(
                  newMtasDataFull.subCollectorListNextLevel[i], map,
                  increaseSourceNumber);
            }
          }
        }
      } else if (collectorType.equals(DataCollector.COLLECTOR_TYPE_DATA)) {
        map.put(newDataCollector, this);
        if (newMtasDataFull.getSize() > 0) {
          MtasDataCollector<?, ?> subCollector = add(increaseSourceNumber);
          setError(newCurrentPosition, newMtasDataFull.errorNumber[0],
              newMtasDataFull.errorList[0], newCurrentExisting);
          setValue(newCurrentPosition, newMtasDataFull.fullValueList[0],
              newMtasDataFull.fullValueList[0].length, newCurrentExisting);
          if (hasSub() && newMtasDataFull.hasSub()) {
            subCollector.merge(newMtasDataFull.subCollectorNextLevel, map,
                increaseSourceNumber);
          }
        }
      } else {
        throw new IOException("cannot merge " + collectorType);
      }
      closeNewList();
    }
  }
45523
@Override
    public void merge(EvaluationBinary other) {
        if (other.countTruePositive == null) {
            //Other is empty - no op
            return;
        }

        if (countTruePositive == null) {
            //This evaluation is empty -> take results from other
            this.countTruePositive = other.countTruePositive;
            this.countFalsePositive = other.countFalsePositive;
            this.countTrueNegative = other.countTrueNegative;
            this.countFalseNegative = other.countFalseNegative;
            this.rocBinary = other.rocBinary;
        } else {
            if (this.countTruePositive.length != other.countTruePositive.length) {
                throw new IllegalStateException("Cannot merge EvaluationBinary instances with different sizes. This "
                                + "size: " + this.countTruePositive.length + ", other size: "
                                + other.countTruePositive.length);
            }

            //Both have stats
            addInPlace(this.countTruePositive, other.countTruePositive);
            addInPlace(this.countTrueNegative, other.countTrueNegative);
            addInPlace(this.countFalsePositive, other.countFalsePositive);
            addInPlace(this.countFalseNegative, other.countFalseNegative);

            if (this.rocBinary != null) {
                this.rocBinary.merge(other.rocBinary);
            }
        }
    }
1219580
void merge(MtasSolrMtasResult newItem) throws IOException {
    HashMap<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map = new HashMap<>();
    if (newItem.dataCollector.withTotal()) {
      dataCollector.setWithTotal();
    }
    dataCollector.merge(newItem.dataCollector, map, true);
    if (newItem.functionData != null) {
      if (functionData == null) {
        functionData = new HashMap<>();
      }
      for (MtasDataCollector<?, ?> keyCollector : newItem.functionData
          .keySet()) {
        if (map.containsKey(keyCollector)) {
          // compute mapped key
          MtasDataCollector<?, ?> newKeyCollector = keyCollector;
          while (map.containsKey(newKeyCollector)) {
            newKeyCollector = map.get(keyCollector);
          }
          if (functionData.containsKey(newKeyCollector)) {
            HashMap<String, MtasSolrMtasResult> tmpList = functionData
                .get(newKeyCollector);
            for (String functionKey : newItem.functionData.get(keyCollector)
                .keySet()) {
              if (tmpList.containsKey(functionKey)) {
                tmpList.get(functionKey).merge(
                    newItem.functionData.get(keyCollector).get(functionKey));
              } else {
                tmpList.put(functionKey,
                    newItem.functionData.get(keyCollector).get(functionKey));
              }
            }
          } else {
            functionData.put(newKeyCollector,
                newItem.functionData.get(keyCollector));
          }
        }
      }
    }
  }
1100121
void merge(final long key, final double[] values) {
    setNotEmpty();
    if (key < theta_) {
      final int index = findOrInsertKey(key);
      if (index < 0) {
        incrementCount();
        setValues(~index, values);
      } else {
        updateValues(index, values);
      }
      rebuildIfNeeded();
    }
  }
1039627
public static final <T> void assign(Set<T> source, Set<T> target)
    {
        target.retainAll(source);
        target.addAll(source);
    }
545918
public void setTarget(final String t) {
    final GantTarget gt = new GantTarget();
    gt.setValue(t);
    targets.add(gt);
  }
1369423
function merge (target, source) {
  if (isMergeable(source)) {
    var keys = Object.keys(source);
    for (var i = 0; i < keys.length; i++) {
      var key = keys[i];
      var sourceSetting = source[key];
      var targetSetting = target[key];

      if (isMergeable(sourceSetting)) {
        // It's a nested object, so merge it recursively
        target[key] = merge(targetSetting || {}, sourceSetting);
      }
      else if (sourceSetting !== undefined) {
        // It's a scalar value, function, or array. No merging necessary. Just overwrite the target value.
        target[key] = sourceSetting;
      }
    }
  }
  return target;
}
602267
private function mergeUnmodifiedPartial(array &$target, array $source)
    {
        foreach ($source as $key => $value) {
            if (is_array($value) && isset($target[$key])) {
                $this->mergeUnmodifiedPartial($target[$key], $value);
            } else {
                $target[$key] = $value;
            }
        }
    }
209101
public static void merge(List<String> sources, String target) throws IOException{
        //读取所有需要合并的词典
        Set<String> set = new HashSet<>();
        AtomicInteger i = new AtomicInteger();
        for(String source : sources){
            try(Stream<String> lines = Files.lines(Paths.get(source), Charset.forName("utf-8"))){
                lines.forEach(line -> {
                    i.incrementAndGet();
                    line = line.trim();
                    // 词长度：大于等于2并且小于等于4
                    // 识别功能 能识别的词 就不用放到词典中了，没必要多此一举
                    //至少要两个中文字符，防止大量无意义或特殊词混入词典
                    if (line.length() > 4
                            || line.length() < 2
                            || !Utils.isChineseCharAndLengthAtLeastTwo(line)
                            || RecognitionTool.recog(line)) {
                        LOGGER.debug("过滤：" + line);
                        return;
                    }
                    set.add(line);
                });
            }
        }
        LOGGER.info("合并词数："+i.get());
        LOGGER.info("保留词数："+set.size());
        List<String> list = set.stream().sorted().collect(Collectors.toList());
        Files.write(Paths.get(target), list, Charset.forName("utf-8"));
    }
58659
public void copyValuesFromTo(Collection<Object> source, List<Object> target) {
        target.addAll(source);
    }
1192890
public static <T> boolean addAll(Collection<T> target, Iterator<? extends T> iterator) {
        Preconditions.checkArgumentNotNull(target, "target");
        boolean modified = false;
        while (iterator.hasNext()) {
            modified |= target.add(iterator.next());
        }
        return modified;
    }
826994
@SuppressWarnings("unchecked")
    public static <E> void mergeArrayIntoCollection(Object array, Collection<E> collection) {
        if (collection == null) {
            throw new IllegalArgumentException("Collection must not be null");
        }
        Object[] arr = ObjectUtils.toObjectArray(array);
        for (Object elem : arr) {
            collection.add((E)elem);
        }
    }
954362
function doMerge(source, target, opts) {
  return target instanceof Array
    ? mergeArrays(source, target)
    : mergeObjects(source, target, opts)
}
1109920
public static <E> void addInPlace(Counter<E> target, Collection<E> arg) {
    for (E key : arg) {
      target.incrementCount(key, 1);
    }
  }
1302522
public void update(final List<Long> groupTargetCounts, final Long totalTargetCount) {
        this.groupTargetCounts = groupTargetCounts;
        this.totalTargetCount = totalTargetCount;

        if (groupTargetCounts != null) {
            long sum = 0;
            for (Long targetCount : groupTargetCounts) {
                sum += targetCount;
            }
            unassignedTargets = totalTargetCount - sum;
        }

        draw();

    }