Util method to make source merge more convenient

@param first  merge params, specifically for the existing source
@param second merge params, specifically for the new source
@return merged result
@throws ParseException cannot parse the input params
970900
public static String merge(String first, String second) throws ParseException {
    JavaParser.setDoNotAssignCommentsPreceedingEmptyLines(false);

    CompilationUnit cu1 = JavaParser.parse(new StringReader(first), true);
    CompilationUnit cu2 = JavaParser.parse(new StringReader(second), true);
    AbstractMerger<CompilationUnit> merger = AbstractMerger.getMerger(CompilationUnit.class);
    CompilationUnit result = merger.merge(cu1, cu2);
    return result.toString();
  }
52617
static void merge(Map<ConfigurationKey, Object> original, Map<ConfigurationKey, Object> toMerge, String mergedSourceDescription) {
        for (Entry<ConfigurationKey, Object> entry : toMerge.entrySet()) {
            Object existing = original.get(entry.getKey());
            if (existing != null) {
                ConfigurationLogger.LOG.configurationKeyAlreadySet(entry.getKey().get(), existing, entry.getValue(), mergedSourceDescription);
            } else {
                original.put(entry.getKey(), entry.getValue());
            }
        }
    }
76161
public static String intersectSeq(final String first, final String second) {
    return intersectSeq(first, second, DELIMITER);
  }
1094285
public static function mergeMethodFailures(self $firstMatchResult, self $secondMatchResult)
    {
        if (!$firstMatchResult->isMethodFailure() || !$secondMatchResult->isMethodFailure()) {
            throw new DomainException('Both match results must be method failures');
        }

        return self::fromMethodFailure(array_unique(
            array_merge($firstMatchResult->getAllowedMethods(), $secondMatchResult->getAllowedMethods())
        ));
    }
360961
public void merge(GridHubConfiguration other) {
    if (other == null) {
      return;
    }
    super.merge(other);

    if (isMergeAble(CapabilityMatcher.class, other.capabilityMatcher, capabilityMatcher)) {
      capabilityMatcher = other.capabilityMatcher;
    }
    if (isMergeAble(Integer.class, other.newSessionWaitTimeout, newSessionWaitTimeout)) {
      newSessionWaitTimeout = other.newSessionWaitTimeout;
    }
    if (isMergeAble(Prioritizer.class, other.prioritizer, prioritizer)) {
      prioritizer = other.prioritizer;
    }
    if (isMergeAble(Boolean.class, other.throwOnCapabilityNotPresent, throwOnCapabilityNotPresent)) {
      throwOnCapabilityNotPresent = other.throwOnCapabilityNotPresent;
    }
    if (isMergeAble(String.class, other.registry, registry)) {
      registry = other.registry;
    }
  }
489767
public static <T> void mergeFrom(byte[] data, int offset, int length, T message, 
            Schema<T> schema, boolean numeric) throws IOException
    {
        final IOContext context = new IOContext(DEFAULT_JSON_FACTORY._getBufferRecycler(), 
                data, false);
        final JsonParser parser = newJsonParser(null, data, offset, offset+length, false, 
                context);
        /*final JsonParser parser = DEFAULT_JSON_FACTORY.createJsonParser(data, offset, 
                length);*/
        try
        {
            mergeFrom(parser, message, schema, numeric);
        }
        finally
        {
            parser.close();
        }
    }
645328
private String merge(final String first, final String[] more) {
        assert first != null : "first must be specified";
        assert more != null : "more must be specified";

        final StringBuilder merged = new StringBuilder();
        merged.append(first);
        for (int i = 0; i < more.length; i++) {
            merged.append(ArchivePath.SEPARATOR);
            merged.append(more[i]);
        }
        return merged.toString();

    }
1179567
private SortedSet<String> mergeSets(SortedSet<String> primary, Set<String> secondary) {
    SortedSet<String> result = primary;
    if (!secondary.isEmpty()) {
      result = new TreeSet<>();
      result.addAll(primary);
      result.addAll(secondary);
    }
    return result;
  }
949190
public static <T> void mergeFrom(XMLStreamReader parser, T message, Schema<T> schema)
            throws IOException, XMLStreamException, XmlInputException
    {
        // final String simpleName = schema.messageName();

        if (parser.nextTag() != START_ELEMENT ||
                !schema.messageName().equals(parser.getLocalName()))
        {
            throw new XmlInputException("Expected token START_ELEMENT: " + schema.messageName());
        }

        if (parser.nextTag() == END_ELEMENT)
        {
            // if(!simpleName.equals(parser.getLocalName()))
            // throw new XmlInputException("Expecting token END_ELEMENT: " + simpleName);

            // empty message;
            return;
        }

        schema.mergeFrom(new XmlInput(parser), message);

        // if(!simpleName.equals(parser.getLocalName()))
        // throw new XmlInputException("Expecting token END_ELEMENT: " + simpleName);
    }
729242
def merge_instances(cls, inst1, inst2):
        
        return Instances(javabridge.static_call(
            "weka/core/Instances", "mergeInstances",
            "(Lweka/core/Instances;Lweka/core/Instances;)Lweka/core/Instances;", inst1.jobject, inst2.jobject))
1113522
protected List<Reference> mergeReferences(
			List<? extends Reference> references1,
			List<? extends Reference> references2) {
		List<Reference> result = new ArrayList<>();
		for (Reference reference : references1) {
			addBestReferenceToList(reference, result);
		}
		for (Reference reference : references2) {
			addBestReferenceToList(reference, result);
		}
		return result;
	}
680253
@Override
    public java.util.concurrent.Future<MergeShardsResult> mergeShardsAsync(String streamName, String shardToMerge, String adjacentShardToMerge,
            com.amazonaws.handlers.AsyncHandler<MergeShardsRequest, MergeShardsResult> asyncHandler) {

        return mergeShardsAsync(
                new MergeShardsRequest().withStreamName(streamName).withShardToMerge(shardToMerge).withAdjacentShardToMerge(adjacentShardToMerge), asyncHandler);
    }
853709
public synchronized void load2() throws IOException {
        COL result = create();

        if (exists()) {
            try (LinesStream stream = linesStream()) {
                for (String line : stream) {
                    if (line.startsWith("#")) continue;   // comment
                    T r = parse(line);
                    if (r != null)
                        result.add(r);
                }
            }
        }

        parsed = readOnly(result);
    }
360870
public void merge(Path parity, Path source, String codecId, 
      int[] checksums) throws IOException {
    dfs.merge(getPathName(parity), getPathName(source), codecId, checksums);
  }
194815
@Override
    public java.util.concurrent.Future<MergeShardsResult> mergeShardsAsync(String streamName, String shardToMerge, String adjacentShardToMerge) {

        return mergeShardsAsync(new MergeShardsRequest().withStreamName(streamName).withShardToMerge(shardToMerge)
                .withAdjacentShardToMerge(adjacentShardToMerge));
    }
1258951
public static <E> List<E> union(final List<? extends E> list1, final List<? extends E> list2) {
		final List<E> result = new ArrayList<E>(list1.size() + list2.size());
		result.addAll(list1);
		result.addAll(list2);
		return result;
	}
357705
def textMerge(self, second):
        
        if second is None: second__o = None
        else: second__o = second._o
        ret = libxml2mod.xmlTextMerge(self._o, second__o)
        if ret is None:raise treeError('xmlTextMerge() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp