Package com.google.common.base

Examples of com.google.common.base.Joiner.join()


      }

      if (isManifest) {
        // See CommandLineRunnerTest to see what the format of this
        // manifest looks like.
        String dependencies = commas.join(module.getSortedDependencyNames());
        out.append(
            String.format("{%s%s}\n",
                module.getName(),
                dependencies.isEmpty() ? "" : ":" + dependencies));
        printManifestTo(module.getInputs(), out);
View Full Code Here


    if (req.getRacks() != null) {
      dedupedRacks.addAll(req.getRacks());
      if(req.getRacks().size() != dedupedRacks.size()) {
        Joiner joiner = Joiner.on(',');
        LOG.warn("ContainerRequest has duplicate racks: "
            + joiner.join(req.getRacks()));
      }
    }
    Set<String> inferredRacks = resolveRacks(req.getNodes());
    inferredRacks.removeAll(dedupedRacks);
View Full Code Here

    if (req.getNodes() != null) {
      HashSet<String> dedupedNodes = new HashSet<String>(req.getNodes());
      if(dedupedNodes.size() != req.getNodes().size()) {
        Joiner joiner = Joiner.on(',');
        LOG.warn("ContainerRequest has duplicate nodes: "
            + joiner.join(req.getNodes()));       
      }
      for (String node : dedupedNodes) {
        addResourceRequest(req.getPriority(), node, req.getCapability(), req,
            true);
      }
View Full Code Here

    Joiner newlineJoiner = Joiner.on('\n');

    if (saveBackup) {
      File backup = new File(f.getAbsolutePath() + BACKUP_SUFFIX);
      try {
        Files.write(newlineJoiner.join(lines), backup, Charset.defaultCharset());
      } catch (IOException e) {
        System.err.println("Couldn't write backup " + backup.getName() + ": " + e.getMessage());
        return;
      }
    }
View Full Code Here

        return;
      }
    }

    try {
      Files.write(newlineJoiner.join(styleLines(lines)), f, Charset.defaultCharset());
    } catch (IOException e) {
      System.err.println("Couldn't write styled file " + f.getName() + ": " + e.getMessage());
      return;
    }
  }
View Full Code Here

   private void setAvailableVirtualDatacenters(final List<Integer> ids) {
      if (ids == null || ids.size() == 0) {
         target.setAvailableVirtualDatacenters("");
      } else {
         Joiner joiner = Joiner.on(",").skipNulls();
         target.setAvailableVirtualDatacenters(joiner.join(ids));
      }
   }

   @Override
   public String toString() {
View Full Code Here

   * @param transformer The transformer to be applied for each object
   * @return a String with all the elements in the collection joined with the token
   */
  public static <F> String join(String token, Collection<F> objects, Function<? super F, String> transformer) {
    Joiner joiner = Joiner.on(token);
    return joiner.join(Iterables.transform(objects, transformer));
  }
 
  /**
   * Same as join(String, Collection<String>) but with the token ", "
   *
 
View Full Code Here

    this.random = random;
  }

  public String getString() {
    Joiner joiner = Joiner.on(' ');
    return joiner.join(getCombination());
  }

  public String getPropertyName() {
    Joiner joiner = Joiner.on("");
    String[] combination = getCombination();
View Full Code Here

  }

  public String getPropertyName() {
    Joiner joiner = Joiner.on("");
    String[] combination = getCombination();
    return joiner.join(combination[0].toLowerCase(), combination[1]);
  }

  public int getNextNumber() {
    return counter++;
  }
View Full Code Here

    @Test
    public void testGuavaJoinerPerformance() throws Exception {
        Joiner joiner = Joiner.on("-separator-").skipNulls();

        for (int i = 0; i < PERFORMANCE_TEST_STEPS; i++) {
            joiner.join("big:table:id:string", "cell:id");
        }
    }

    @Test
    public void testFastJoinerPerformance() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.