Merge two element counters. For all elements, we take the max count from both counters.
493884
def merge(self, other):
        ''''''
        our_element_frequencies = self.items
        their_element_frequencies = other.items
        for element_name, freq in sorted(our_element_frequencies.iteritems()):
            our_element_frequencies[element_name] = max(our_element_frequencies.get(element_name, 0), their_element_frequencies.get(element_name, 0))
        for element_name, freq in sorted(their_element_frequencies.iteritems()):
            if element_name not in our_element_frequencies:
                our_element_frequencies[element_name] = their_element_frequencies[element_name]
1238725
public void add(Counter<? extends Pair<T>> counter) {
        for (Map.Entry<? extends Pair<T>,Integer> e : counter) {
            count(e.getKey(), e.getValue());
        }
    }
1236738
private void mergeForceCollapse() {
        while (stackSize > 1) {
            int n = stackSize - 2;
            if (n > 0 && runLen[n - 1] < runLen[n + 1])
                n--;
            mergeAt(n);
        }
    }
639767
function mergeAdjacent (markups) {
  var i

  for (i = 0; i < markups.length - 1; i += 1) {
    if (!canMerge(markups[i], markups[i + 1]))
      continue

    markups[i].end = Math.max(markups[i].end, markups[i + 1].end)
    markups.splice(i + 1, 1)
    i -= 1
  }
}
189778
private void merge(ExecutionStatistics otherStatistics) {
        for (String s : otherStatistics.executionInfo.keySet())
        {
            TimingData thisStats = this.executionInfo.get(s);
            TimingData otherStats = otherStatistics.executionInfo.get(s);
            if(thisStats == null) {
                this.executionInfo.put(s,otherStats);
            } else {
                thisStats.merge(otherStats);
            }

        }
    }
310834
function merge(a, b) {

    /* result set */
    var c = [];

    /* as long as there are elements in the arrays to be merged */
    while (a.length > 0 || b.length > 0) {

      /* are there elements to be merged, if yes, compare them and merge */
      var n = a.length > 0 && b.length > 0 ? a[0] < b[0] ? a.shift() : b.shift() : b.length > 0 ? b.shift() : a.length > 0 ? a.shift() : null;

      /* always push the smaller one onto the result set */
      if (n !== null) {
        c.push(n);
      }
    }
    return c;
  }
987828
def merge_intervals(intervals):
    
    if intervals is None:
        return None
    intervals.sort(key=lambda i: i[0])
    out = [intervals.pop(0)]
    for i in intervals:
        if out[-1][-1] >= i[0]:
            out[-1][-1] = max(out[-1][-1], i[-1])
        else:
            out.append(i)
    return out
422125
def merge_all_cells(cells):
    
    current = 0

    while len(cells) > 1:
        count = 0

        while count < len(cells):
            cell1 = cells[current]
            cell2 = cells[count]

            merge_direction = get_merge_direction(cell1, cell2)
            if not merge_direction == "NONE":
                merge_cells(cell1, cell2, merge_direction)

                if current > count:
                    current -= 1

                cells.pop(count)

            else:
                count += 1

        current += 1

        if current >= len(cells):
            current = 0

    return cells[0].text
1231326
def _merge_slices(match_slices):
        """"""
        # Sort by earliest range, then by largest range.
        match_slices.sort(key=lambda x: (x[0], -x[1]))
        merged_slices = [match_slices.pop(0)]
        for slice_indices in match_slices:
            last_end = merged_slices[-1][1]
            if slice_indices[0] <= last_end:
                if slice_indices[1] > last_end:
                    merged_slices[-1][1] = slice_indices[1]
            else:
                merged_slices.append(slice_indices)
        return merged_slices
530079
public void combine(@NonNull EnhancedDoubleStatistics other) {
      count += other.count;
      sum += other.sum;
      sumOfSq += other.sumOfSq;
      min = Math.min(min, other.min);
      max = Math.max(max, other.max);
   }
831765
public <T2 extends T> void incrementAll(Counter<T2> other) {
        for (T2 element: other.keySet()) {
            double cnt = other.getCount(element);
            incrementCount(element, cnt);
        }
    }
1068299
def countByValue(self):
        
        def countPartition(iterator):
            counts = defaultdict(int)
            for obj in iterator:
                counts[obj] += 1
            yield counts

        def mergeMaps(m1, m2):
            for k, v in m2.items():
                m1[k] += v
            return m1
        return self.mapPartitions(countPartition).reduce(mergeMaps)
905421
@SuppressWarnings("unchecked")
  private int mergeRange(ParentSoyNode<?> parent, int start, int lastNonEmptyRawTextNode, int end) {
    checkArgument(start < end);
    if (start == -1 || end == start + 1) {
      return end;
    }
    // general case, there are N rawtextnodes to merge where n > 1
    // merge all the nodes together, then drop all the raw text nodes from the end
    RawTextNode newNode =
        RawTextNode.concat(
            (List<RawTextNode>) parent.getChildren().subList(start, lastNonEmptyRawTextNode + 1));
    ((ParentSoyNode) parent).replaceChild(start, newNode);
    for (int i = end - 1; i > start; i--) {
      parent.removeChild(i);
    }
    return start + 1;
  }
271346
def merge(self, frame):
        
        for column_name, _ in self._column_stats.items():
            data_arr = frame[[column_name]].values
            count, min_max_tup, mean, _, _, _ = \
                scistats.describe(data_arr)
            stats_counter = StatCounter()
            stats_counter.n = count
            stats_counter.mu = mean
            stats_counter.m2 = np.sum((data_arr - mean) ** 2)
            stats_counter.minValue, stats_counter.maxValue = min_max_tup
            self._column_stats[column_name] = self._column_stats[
                column_name].mergeStats(stats_counter)
        return self
1158943
public void mergeTracker(DRConsumerDrIdTracker tracker) {
        final long newSafePoint = Math.max(tracker.getSafePointDrId(), getSafePointDrId());
        m_map.addAll(tracker.m_map);
        truncate(newSafePoint);
        m_lastSpUniqueId = Math.max(m_lastSpUniqueId, tracker.m_lastSpUniqueId);
        m_lastMpUniqueId = Math.max(m_lastMpUniqueId, tracker.m_lastMpUniqueId);
    }
1268454
public static <T> List<T> last(List<T> elements, int limit) {
        ArrayList<T> res = new ArrayList<T>();
        for (int i = 0; i < elements.size(); i++) {
            if (res.size() >= limit) {
                break;
            }
            res.add(elements.get(elements.size() - 1 - i));
        }
        return res;
    }
752364
public static List<DiskRange> mergeAdjacentDiskRanges(Collection<DiskRange> diskRanges, DataSize maxMergeDistance, DataSize maxReadSize)
    {
        // sort ranges by start offset
        List<DiskRange> ranges = new ArrayList<>(diskRanges);
        Collections.sort(ranges, new Comparator<DiskRange>()
        {
            @Override
            public int compare(DiskRange o1, DiskRange o2)
            {
                return Long.compare(o1.getOffset(), o2.getOffset());
            }
        });

        // merge overlapping ranges
        long maxReadSizeBytes = maxReadSize.toBytes();
        long maxMergeDistanceBytes = maxMergeDistance.toBytes();
        ImmutableList.Builder<DiskRange> result = ImmutableList.builder();
        DiskRange last = ranges.get(0);
        for (int i = 1; i < ranges.size(); i++) {
            DiskRange current = ranges.get(i);
            DiskRange merged = last.span(current);
            if (merged.getLength() <= maxReadSizeBytes && last.getEnd() + maxMergeDistanceBytes >= current.getOffset()) {
                last = merged;
            }
            else {
                result.add(last);
                last = current;
            }
        }
        result.add(last);

        return result.build();
    }