{@inheritDoc}

@see org.jboss.shrinkwrap.api.Archive#merge(org.jboss.shrinkwrap.api.Archive, org.jboss.shrinkwrap.api.Path,
org.jboss.shrinkwrap.api.Filter)
775183
@Override
    public T merge(Archive<?> source, ArchivePath path, Filter<ArchivePath> filter) throws IllegalArgumentException {
        // Precondition checks
        Validate.notNull(source, "No source archive was specified");
        Validate.notNull(path, "No path was specified");
        Validate.notNull(filter, "No filter was specified");

        // Get existing contents from source archive
        final Map<ArchivePath, Node> sourceContent = source.getContent();
        Validate.notNull(sourceContent, "Source archive content can not be null.");

        // Add each asset from the source archive
        for (final Entry<ArchivePath, Node> contentEntry : sourceContent.entrySet()) {
            final Node node = contentEntry.getValue();
            ArchivePath nodePath = new BasicPath(path, contentEntry.getKey());
            if (!filter.include(nodePath)) {
                continue;
            }
            // Delegate
            if (node.getAsset() == null) {
                addAsDirectory(nodePath);
            } else {
                add(node.getAsset(), nodePath);
            }
        }
        return covariantReturn();
    }
687918
public static void mergeTiff(BufferedImage[] inputImages, File outputTiff) throws IOException {
        mergeTiff(inputImages, outputTiff, null);
    }
1327193
public static <T> void mergeFrom(byte[] data, T message, Schema<T> schema)
    {
        IOUtil.mergeFrom(data, 0, data.length, message, schema, true);
    }
808372
public static void mergeFiles(File[] files, File destinationFile, String filterRegex) throws IOException {
        createNewFile(destinationFile);
        for (File file : files) {
            mergeFiles(file, destinationFile, filterRegex);
        }
    }
1318610
public static <T> void mergeFrom(Reader reader, T message, Schema<T> schema,
            boolean numeric) throws IOException
    {
        final JsonParser parser = DEFAULT_JSON_FACTORY.createJsonParser(reader);
        try
        {
            mergeFrom(parser, message, schema, numeric);
        }
        finally
        {
            parser.close();
        }
    }
13645
public void merge(Resource resource) {
        if (resource == null) {
            return;
        }

        checkRel(resource);
        checkHrefs(resource);

        if (resource.templated()) {
            this.pathParams.putAll(resource.pathParams);
            this.queryParams.putAll(resource.queryParams);
        }
        if (resource.hints() != null) {
            this.hints.merge(resource.hints());
        }
    }
800203
public void merge(String mergeResultPath, String... resultPaths){
        try{
            Map<String, AtomicInteger> map = new ConcurrentHashMap<>();
            for(String resultPath : resultPaths) {
                Files.lines(Paths.get(resultPath)).forEach(line -> {
                    String[] attrs = line.split("\\s+");
                    if (attrs != null && attrs.length == 2) {
                        statistics(attrs[0], Integer.parseInt(attrs[1]), map);
                    }
                });
            }
            dump(map, mergeResultPath);
        }catch (Exception e){
            LOGGER.error("merge error!", e);
        }
    }
412264
public synchronized void merge(BloomFilter filter) {
        if (!this.matchesAll() && !filter.matchesAll()) {
            checkArgument(filter.data.length == this.data.length &&
                          filter.hashFuncs == this.hashFuncs &&
                          filter.nTweak == this.nTweak);
            for (int i = 0; i < data.length; i++)
                this.data[i] |= filter.data[i];
        } else {
            this.data = new byte[] {(byte) 0xff};
        }
    }
617285
@Override
    public Path resolve(final Path other) {
        if (other == null) {
            throw new IllegalArgumentException("other path must be specified");
        }

        if (other.isAbsolute()) {
            return other;
        }

        if (other.toString().length() == 0) {
            return this;
        }

        // Else join other to this
        final StringBuilder sb = new StringBuilder(this.path);
        if (!this.path.endsWith(ArchivePath.SEPARATOR_STRING)) {
            sb.append(ArchivePath.SEPARATOR);
        }
        sb.append(other.toString());
        final Path newPath = new ShrinkWrapPath(sb.toString(), this.fileSystem);
        return newPath;
    }
70009
@Override
    public T add(final Archive<?> archive, final String path, final Class<? extends StreamExporter> exporter) {
        this.getArchive().add(archive, path, exporter);
        return covarientReturn();
    }
1033173
private static String mergePaths(String path1, String path2)
  {
    return path1 + (path1.endsWith(Path.SEPARATOR) ? "" : Path.SEPARATOR) + path2;
  }
677536
function mergeLists(list, _filters) {
        if (list.specFiles) {
            list.specFiles.forEach(value => _filters.specFiles[value] = true);
        }
        if (list.testcaseFiles) {
            list.testcaseFiles.forEach(value => _filters.testcaseFiles[value] = true);
        }
        if (list.features) {
            list.features.forEach(value => _filters.features[value] = true);
        }
        if (list.specs) {
            list.specs.forEach(value => _filters.specs[value] = true);
        }
        if (list.testcases) {
            list.testcases.forEach(value => _filters.testcases[value] = true);
        }
        if (list.listFiles) {
            for (const listFile of list.listFiles) {
                // complete cli listFiles paths
                const listFilePath = path.join(listsDir, `${listFile}.list.ts`);
                if (!fs.existsSync(listFilePath)) {
                    throw new Error(`List file could not be found: ${listFilePath}`);
                }
                else {
                    const sublist = require(listFilePath).default;
                    // recursively traverse sub list files
                    mergeLists(sublist, _filters);
                }
            }
        }
    }
419684
@SuppressWarnings("unchecked")
	private void mergeMap (Map<String, Object> dest, Object source) throws YamlReaderException {
		if (source instanceof Collection) {
			for (Object item : ((Collection<Object>)source))
				mergeMap(dest, item);
		} else if (source instanceof Map) {
			Map<String, Object> map = (Map<String, Object>)source;
			for (Map.Entry<String, Object> entry : map.entrySet()) {
				if (!dest.containsKey(entry.getKey())) dest.put(entry.getKey(), entry.getValue());

			}
		} else
			throw new YamlReaderException("Expected a mapping or a sequence of mappings for a '<<' merge field but found: "
				+ source.getClass().getSimpleName());

	}
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();

    }
360870
public void merge(Path parity, Path source, String codecId, 
      int[] checksums) throws IOException {
    dfs.merge(getPathName(parity), getPathName(source), codecId, checksums);
  }
510756
protected void mergeExistedElement(XmlElement src, XmlElement dest) {

    // 合并属性
    List<Attribute> srcAttributes = src.getAttributes();
    List<Attribute> destAttributes = dest.getAttributes();
    for (Attribute srcAttr : srcAttributes) {
      Attribute matched = null;
      for (Attribute destAttr : destAttributes) {
        if (StringUtils.equals(srcAttr.getName(), destAttr.getName()) &&
            StringUtils.equals(srcAttr.getValue(), destAttr.getValue())) {
          matched = destAttr;
        }
      }
      // 不存在则添加到目标元素的属性列表中
      if (matched == null) {
        destAttributes.add(srcAttributes.indexOf(srcAttr), srcAttr);
      }
    }

    // 重组子节点
    // reformationTheElementChilds(src);
    // reformationTheElementChilds(dest);

    // 暂时不做处理 ---留待后续添加
  }
491797
@Override
  public void merge(MergeState mergeState) throws IOException {
    final List<Fields> fields = new ArrayList<>();
    final List<ReaderSlice> slices = new ArrayList<>();

    int docBase = 0;

    for (int readerIndex = 0; readerIndex < mergeState.fieldsProducers.length; readerIndex++) {
      final FieldsProducer f = mergeState.fieldsProducers[readerIndex];

      final int maxDoc = mergeState.maxDocs[readerIndex];
      f.checkIntegrity();
      slices.add(new ReaderSlice(docBase, maxDoc, readerIndex));
      fields.add(f);
      docBase += maxDoc;
    }

    Fields mergedFields = new MappedMultiFields(mergeState,
        new MultiFields(fields.toArray(Fields.EMPTY_ARRAY),
            slices.toArray(ReaderSlice.EMPTY_ARRAY)));
    write(mergedFields);
  }