List of usage examples for com.google.common.collect ImmutableSet.Builder add
boolean add(E e);
From source file:com.assylias.jbloomberg.SubscriptionBuilder.java
Set<String> getFieldsAsString() { ImmutableSet.Builder<String> set = ImmutableSet.builder(); for (RealtimeField f : fields) { set.add(f.toString()); }/*from w w w . j av a 2s . co m*/ return set.build(); }
From source file:com.facebook.buck.core.files.FileTreeTransformer.java
@Override public ImmutableSet<FileTreeKey> discoverDeps(FileTreeKey key, TransformationEnvironment env) { DirectoryList currentDir = env.getDep(ImmutableDirectoryListKey.of(key.getPath())); ImmutableSortedSet<Path> subDirs = currentDir.getDirectories(); if (subDirs.isEmpty()) { return ImmutableSet.of(); }// w w w . j a v a 2s . c o m ImmutableSet.Builder<FileTreeKey> depsBuilder = ImmutableSet.builderWithExpectedSize(subDirs.size()); for (Path path : subDirs) { depsBuilder.add(ImmutableFileTreeKey.of(path)); } return depsBuilder.build(); }
From source file:com.facebook.buck.ocaml.OcamlDepToolStep.java
@Override protected void addOptions(ExecutionContext context, ImmutableSet.Builder<ProcessExecutor.Option> options) { // We need this else we get output with color codes which confuses parsing options.add(ProcessExecutor.Option.EXPECTING_STD_ERR); options.add(ProcessExecutor.Option.EXPECTING_STD_OUT); }
From source file:com.facebook.buck.android.ExopackageInstaller.java
/** * @param output Output of "ls" command. * @param filePattern A {@link Pattern} that is used to check if a file is valid, and if it * matches, {@code filePattern.group(1)} should return the hash in the file name. * @param requiredHashes Hashes of dex files required for this apk. * @param foundHashes Builder to receive hashes that we need and were found. * @param toDelete Builder to receive files that we need to delete. *///from w ww .j av a 2 s .c o m @VisibleForTesting static void processLsOutput(String output, Pattern filePattern, ImmutableSet<String> requiredHashes, ImmutableSet.Builder<String> foundHashes, ImmutableSet.Builder<String> toDelete) { for (String line : Splitter.on(LINE_ENDING).omitEmptyStrings().split(output)) { if (line.equals("lock")) { continue; } Matcher m = filePattern.matcher(line); if (m.matches()) { if (requiredHashes.contains(m.group(1))) { foundHashes.add(m.group(1)); } else { toDelete.add(line); } } else { toDelete.add(line); } } }
From source file:org.onosproject.provider.nil.cli.CreateNullHost.java
private Set<IpAddress> getIps(String hostIps) { ImmutableSet.Builder<IpAddress> ips = ImmutableSet.builder(); String[] csv = hostIps.split(","); for (String s : csv) { ips.add(IpAddress.valueOf(s)); }/* w w w . jav a 2 s .c o m*/ return ips.build(); }
From source file:org.apache.abdera2.common.templates.MultiContext.java
public Iterator<String> iterator() { ImmutableSet.Builder<String> names = ImmutableSet.builder(); for (Context context : contexts) for (String name : context) names.add(name); return names.build().iterator(); }
From source file:org.dcache.auth.attributes.PrefixRestriction.java
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { int countPrefixes = stream.readInt(); ImmutableSet.Builder<FsPath> builder = ImmutableSet.builder(); for (int i = 0; i < countPrefixes; i++) { builder.add(FsPath.create(stream.readObject().toString())); }//from w w w.j a v a 2s. co m prefixes = builder.build(); }