java.util.Vector.stream()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中java.util.Vector.stream()方法的一些代码示例,展示了Vector.stream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.stream()方法的具体详情如下:
包路径:java.util.Vector
类名称:Vector
方法名:stream

Vector.stream介绍

暂无

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * get the variable list as an array
 * @return array of key=value assignment strings
 * @throws BuildException if any variable is misconfigured
 */
public String[] getVariables() throws BuildException {
  if (variables.isEmpty()) {
    return null;
  }
  return variables.stream().map(Variable::getContent).toArray(String[]::new);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Get the Attribute's value.
 *
 * @return the attribute's value.
 */
public String getValue() {
  return values.isEmpty() ? null
    : values.stream().collect(Collectors.joining(" "));
}

代码示例来源:origin: org.apache.ant/ant

String vectorToList(Vector<String> v) {
  return v.stream().collect(Collectors.joining(", "));
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Tests whether or not the parent classloader should be checked for a
 * resource before this one. If the resource matches both the "use parent
 * classloader first" and the "use this classloader first" lists, the latter
 * takes priority.
 *
 * @param resourceName
 *            The name of the resource to check. Must not be
 *            <code>null</code>.
 *
 * @return whether or not the parent classloader should be checked for a
 *         resource before this one is.
 */
private boolean isParentFirst(final String resourceName) {
  // default to the global setting and then see
  // if this class belongs to a package which has been
  // designated to use a specific loader first
  // (this one or the parent one)
  // TODO - shouldn't this always return false in isolated mode?
  return loaderPackages.stream().noneMatch(resourceName::startsWith)
      && (systemPackages.stream().anyMatch(resourceName::startsWith) || parentFirst);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Returns a stream to read the requested resource name from this loader.
 *
 * @param name The name of the resource for which a stream is required.
 *             Must not be <code>null</code>.
 *
 * @return a stream to the required resource or <code>null</code> if
 *         the resource cannot be found on the loader's classpath.
 */
private InputStream loadResource(final String name) {
  // we need to search the components of the path to see if we can
  // find the class we want.
  return pathComponents.stream().map(path -> getResourceStream(path, name))
      .filter(Objects::nonNull).findFirst().orElse(null);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Check to see if the target is up to date with respect to input files.
 * @param files the list of files to check.
 * @return true if the cab file is newer than its dependents.
 */
protected boolean isUpToDate(Vector<String> files) {
  final long cabModified = cabFile.lastModified();
  return files.stream().map(f -> FILE_UTILS.resolveFile(baseDir, f))
    .mapToLong(File::lastModified).allMatch(t -> t < cabModified);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Names of the classes to process.
 * @return the array of classes.
 * @since Ant 1.6.3
 */
public String[] getClasses() {
  Stream<String> stream = Stream.concat(
    files.stream()
      .map(fs -> fs.getDirectoryScanner(getProject()).getIncludedFiles())
      .flatMap(Stream::of)
      .map(s -> s.replace('\\', '.').replace('/', '.')
        .replaceFirst("\\.class$", "")),
    classes.stream().map(ClassArgument::getName));
  if (cls != null) {
    stream = Stream.concat(Stream.of(cls.split(",")).map(String::trim),
      stream);
  }
  return stream.toArray(String[]::new);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Find a ResourceLocation instance for the given publicId.
 *
 * @param publicId the publicId of the Resource for which local information
 *        is required.
 * @return a ResourceLocation instance with information on the local location
 *         of the Resource or null if no such information is available.
 */
private ResourceLocation findMatchingEntry(String publicId) {
  return getElements().stream()
    .filter(e -> e.getPublicId().equals(publicId)).findFirst()
    .orElse(null);
}

代码示例来源:origin: org.apache.ant/ant

private boolean hasAlreadyBeenImported(Resource importedResource,
                    Vector<Object> importStack) {
  File importedFile = importedResource.asOptional(FileProvider.class)
    .map(FileProvider::getFile).orElse(null);
  URL importedURL = importedResource.asOptional(URLProvider.class)
    .map(URLProvider::getURL).orElse(null);
  return importStack.stream().anyMatch(
    o -> isOneOf(o, importedResource, importedFile, importedURL));
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Execute the specified sequence of targets, and the targets
 * they depend on.
 *
 * @param names A vector of target name strings to execute.
 *              Must not be <code>null</code>.
 *
 * @exception BuildException if the build failed.
 */
public void executeTargets(final Vector<String> names) throws BuildException {
  setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS,
      names.stream().collect(Collectors.joining(",")));
  getExecutor().executeTargets(this, names.toArray(new String[names.size()]));
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Logs the compilation parameters, adds the files to compile and logs the
 * &quot;niceSourceList&quot;
 * @param jspc the compiler task for logging
 * @param compileList the list of files to compile
 * @param cmd the command line used
 */
protected void logAndAddFilesToCompile(JspC jspc,
                    Vector<String> compileList,
                    CommandlineJava cmd) {
  jspc.log("Compilation " + cmd.describeJavaCommand(),
       Project.MSG_VERBOSE);
  String niceSourceList = compileList.stream()
          .peek(arg -> cmd.createArgument().setValue(arg))
          .map(arg -> String.format("    %s%n", arg))
          .collect(Collectors.joining(""));
  jspc.log(String.format("File%s to be compiled:%n%s",
      compileList.size() == 1 ? "" : "s", niceSourceList), Project.MSG_VERBOSE);
}

代码示例来源:origin: org.apache.ant/ant

additionalBaseDirs.stream().map(File::getPath)
  .map(p -> new Path(null, p)).forEach(analyzer::addClassPath);

代码示例来源:origin: org.apache.ant/ant

/**
 * Logs the compilation parameters, adds the files to compile and logs the
 * &quot;niceSourceList&quot;
 * @param cmd the commandline args
 */
protected void logAndAddFilesToCompile(Commandline cmd) {
  Vector<String> compileList = attributes.getCompileList();
  attributes.log("Compilation " + cmd.describeArguments(),
          Project.MSG_VERBOSE);
  String niceSourceList = (compileList.size() == 1 ? "File" : "Files") +
      " to be compiled:" +
      compileList.stream().peek(arg -> cmd.createArgument().setValue(arg))
          .collect(Collectors.joining("    "));
  attributes.log(niceSourceList, Project.MSG_VERBOSE);
}

代码示例来源:origin: org.apache.ant/ant

filterChains.stream().map(FilterChain::getFilterReaders)
  .flatMap(Collection::stream).collect(Collectors.toList());

代码示例来源:origin: org.apache.ant/ant

/**
 * Find out whether this Files collection has patterns.
 *
 * @return whether any patterns are in this container.
 */
public synchronized boolean hasPatterns() {
  if (isReference()) {
    return getRef().hasPatterns();
  }
  dieOnCircularReference();
  return hasPatterns(defaultPatterns)
    || additionalPatterns.stream().anyMatch(this::hasPatterns);
}

代码示例来源:origin: org.apache.ant/ant

boolean interrupted = false;
TaskRunnable[] runnables = nestedTasks.stream().map(TaskRunnable::new)
  .toArray(TaskRunnable[]::new);

代码示例来源:origin: org.apache.ant/ant

private void setProperties(final Project project) {
  project.init();
  // resolve properties
  final PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(project);
  @SuppressWarnings({ "rawtypes", "unchecked" })
  final Map raw = new HashMap(definedProps);
  @SuppressWarnings("unchecked")
  final Map<String, Object> props = raw;
  final ResolvePropertyMap resolver = new ResolvePropertyMap(project,
      NOPROPERTIES, propertyHelper.getExpanders());
  resolver.resolveAllProperties(props, null, false);
  // set user-define properties
  props.forEach((arg, value) -> project.setUserProperty(arg, String.valueOf(value)));
  project.setUserProperty(MagicNames.ANT_FILE,
              buildFile.getAbsolutePath());
  project.setUserProperty(MagicNames.ANT_FILE_TYPE,
              MagicNames.ANT_FILE_TYPE_FILE);
  // this list doesn't contain the build files default target,
  // which may be added later unless targets have been specified
  // on the command line. Therefore the property gets set again
  // in Project#executeTargets when we can be sure the list is
  // complete.
  // Setting it here allows top-level tasks to access the
  // property.
  project.setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS,
      targets.stream().collect(Collectors.joining(",")));
}

代码示例来源:origin: org.apache.ant/ant

if (locals.stream().map(targetsMap::get)
  .filter(Objects::nonNull)
  .anyMatch(other -> other.dependsOn(owningTargetName))) {

代码示例来源:origin: jshiell/checkstyle-idea

@SuppressWarnings("unchecked")
List<TogglableTreeNode> getAllChildren() {
  return (List<TogglableTreeNode>) children.stream()
      .map(child -> (TogglableTreeNode) child)
      .collect(Collectors.toList());
}

代码示例来源:origin: org.apache.ant/ant

replyToList.stream().map(Object::toString).forEach(mailMessage::replyto);

相关文章

微信公众号

最新文章

更多