Package com.google.common.base

Examples of com.google.common.base.Splitter.split()


    for (final String entry : entries) {
      boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(entry);
      boolean _not = (!_isNullOrEmpty);
      if (_not) {
        Splitter _on_1 = Splitter.on(":!");
        final Iterable<String> split = _on_1.split(entry);
        String _head = IterableExtensions.<String>head(split);
        Iterable<String> _tail = IterableExtensions.<String>tail(split);
        String _head_1 = IterableExtensions.<String>head(_tail);
        result.put(_head, _head_1);
      }
View Full Code Here


    Splitter roleSplitter = ROLE_SPLITTER.omitEmptyStrings().trimResults();
    for (Map.Entry<String, String> entry : groupsSection.entrySet()) {
      String groupName = Strings.nullToEmpty(entry.getKey()).trim();
      String groupPrivileges = Strings.nullToEmpty(entry.getValue()).trim();
      Collection<String> resolvedGroupPrivileges = Sets.newHashSet();
      for (String roleName : roleSplitter.split(groupPrivileges)) {
        if (roleNameToPrivilegeMap.containsKey(roleName)) {
          resolvedGroupPrivileges.addAll(roleNameToPrivilegeMap
              .get(roleName));
        } else {
          LOGGER.warn("Role {} for group {} does not exist in privileges section in {}",
View Full Code Here

    for (String line : CharStreams.readLines(input)) {
      if (header) {
        // skip
        header = false;
      } else {
        Iterable<String> values = onComma.split(line);
        double alpha = Double.parseDouble(Iterables.get(values, 0));
        double beta = Double.parseDouble(Iterables.get(values, 1));
        double x = Double.parseDouble(Iterables.get(values, 2));
        double ref = Double.parseDouble(Iterables.get(values, 3));
        double actual = Gamma.incompleteBeta(alpha, beta, x);
View Full Code Here

    }
    Splitter roleSplitter = ROLE_SPLITTER.omitEmptyStrings().trimResults();
    for (Map.Entry<String, String> entry : groupsSection.entrySet()) {
      String groupName = stringInterner.intern(Strings.nullToEmpty(entry.getKey()).trim());
      String groupPrivileges = Strings.nullToEmpty(entry.getValue()).trim();
      for (String roleName : roleSplitter.split(groupPrivileges)) {
        roleName = stringInterner.intern(roleName);
        if (roleNameToPrivilegeMap.containsKey(roleName)) {
          Set<String> privileges = groupRolePrivilegeTable.get(groupName, roleName);
          if (privileges == null) {
            privileges = new HashSet<String>();
View Full Code Here

    Readable isr = new InputStreamReader(Resources.getResource(resourceName).openStream());
    List<String> data = CharStreams.readLines(isr);
    String first = data.get(0);
    data = data.subList(1, data.size());

    List<String> values = Lists.newArrayList(onCommas.split(first));
    Matrix r = new DenseMatrix(data.size(), values.size());

    int column = 0;
    Map<String, Integer> labels = Maps.newHashMap();
    for (String value : values) {
View Full Code Here

    r.setColumnLabelBindings(labels);

    int row = 0;
    for (String line : data) {
      column = 0;
      values = Lists.newArrayList(onCommas.split(line));
      for (String value : values) {
        r.set(row, column, Double.parseDouble(value));
        column++;
      }
      row++;
View Full Code Here

    }
    Splitter commaSplitter = Splitter.on(',').omitEmptyStrings().trimResults();
    Splitter equalSplitter = Splitter.on('=').omitEmptyStrings().trimResults();
    Map<String, String> partitionValues = Maps.newHashMap();
    for (String keyValStr : commaSplitter.split(outputTablePartitionString)) {
      List<String> keyVal = Lists.newArrayList(equalSplitter.split(keyValStr));
      if (keyVal.size() != 2) {
        throw new IllegalArgumentException(
            "Unrecognized partition value format: " +
            outputTablePartitionString);
      }
View Full Code Here

    }
    Splitter commaSplitter = Splitter.on(',').omitEmptyStrings().trimResults();
    Splitter equalSplitter = Splitter.on('=').omitEmptyStrings().trimResults();
    Map<String, String> partitionValues = Maps.newHashMap();
    for (String keyValStr : commaSplitter.split(outputTablePartitionString)) {
      List<String> keyVal = Lists.newArrayList(equalSplitter.split(keyValStr));
      if (keyVal.size() != 2) {
        throw new IllegalArgumentException(
            "Unrecognized partition value format: " +
            outputTablePartitionString);
      }
View Full Code Here

    }

    public static ImmutableSet<HostAddress> parseNodes(String nodes)
    {
        Splitter splitter = Splitter.on(',').omitEmptyStrings().trimResults();
        return ImmutableSet.copyOf(transform(splitter.split(nodes), toHostAddress()));
    }

    private static Function<String, HostAddress> toHostAddress()
    {
        return new Function<String, HostAddress>()
View Full Code Here

        String oldDiff = cleanUp(oldRecord);
        String newDiff = cleanUp(newRecord);

        Splitter splitter = Splitter.on(CharMatcher.anyOf("\r\n"));
        List<String> oldLines = Lists.newArrayList(splitter.split(oldDiff));
        List<String> newLines = Lists.newArrayList(splitter.split(newDiff));
        if (oldLines.equals(newLines)) {
            return "";
        }
        Patch diffs = DiffUtils.diff(oldLines, newLines);
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.