List of usage examples for com.google.common.collect Sets newTreeSet
public static <E extends Comparable> TreeSet<E> newTreeSet()
From source file:com.facebook.buck.java.abi.ZipWalker.java
@Override public void walk(FileAction onFile) throws IOException { Set<String> names = Sets.newTreeSet(); // Get the set of all names and sort them, so that we get a deterministic iteration order. try (FileInputStream fis = new FileInputStream(zipFile.toFile()); BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) { for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) { if (entry.isDirectory()) { continue; }/* w ww .j av a 2 s .c om*/ names.add(entry.getName()); } } // Iterate over the file entries, calling the action on each one. if (!names.isEmpty()) { try (ZipFile zip = new ZipFile(zipFile.toFile())) { for (String name : names) { try (InputStream is = zip.getInputStream(zip.getEntry(name))) { onFile.visit(Paths.get(name), is); } } } } }
From source file:sc.calendar.ui.CalendarEventAdapter.java
public CalendarEventAdapter(Context context, int textViewResourceId, DbInterface db) { super(context, textViewResourceId); this.items = Sets.newTreeSet(); this.context = context; this.db = db; }
From source file:com.google.transconsole.common.messages.MessageProperties.java
public MessageProperties() { contentType = null;/* w w w . j av a 2 s. c o m*/ description = null; name = null; sources = Sets.newTreeSet(); meaning = null; // ID generator defines null == empty meaning isHidden = false; isObsolete = false; }
From source file:com.facebook.buck.java.abi.DirectoryWalker.java
@Override public void walk(final FileAction onFile) throws IOException { // First find all dir entries and sort them to create a deterministic iteration order. final Set<Path> files = Sets.newTreeSet(); SimpleFileVisitor<Path> visitor = new SimpleFileVisitor<Path>() { @Override/* w ww . j a v a 2 s . c om*/ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Path relativized = root.relativize(file); files.add(relativized); return FileVisitResult.CONTINUE; } }; Files.walkFileTree(root, visitor); // Now call the action on each of the files. for (Path path : files) { try (InputStream is = Files.newInputStream(root.resolve(path)); BufferedInputStream bis = new BufferedInputStream(is)) { onFile.visit(path, bis); } } }
From source file:org.gradoop.model.impl.id.GradoopIdSet.java
/** * Creates a new instance. */ public GradoopIdSet() { identifiers = Sets.newTreeSet(); }
From source file:symbolicexecutor.ApiBasedInputGenerator.java
@Override public Collection<Input> generateNewInputs(Input oldInput, SymbolicExecutionResult result) { int conditionNumber = -1; TreeSet<Input> newInputs = Sets.newTreeSet(); Set<Expr> assumptions = Sets.newHashSet(); cvc3Context.push(); // Checkpoint the solver state for (SymbolicExpression constraint : result.pathCondition(AdapterList.DEFAULT_ADAPTERS)) { conditionNumber++;//from w ww .j a va 2 s . c o m if (conditionNumber < oldInput.depthBeforeBranching) { cvc3Context.assume(constraint); } else { Map<String, JsValue> model = cvc3Context.query(constraint); if (model != null) { String[] inputArgs = new String[oldInput.numArgs()]; for (int argIndex = 0; argIndex < oldInput.numArgs(); argIndex++) { inputArgs[argIndex] = model.get("sym" + argIndex).toString(); } newInputs.add(new Input(inputArgs, conditionNumber + 1)); // Assume that the constraint holds so that later inputs follow the // same path as oldInput for one additional branch. Note that we only // have to do this for invalid constraints, because valid constraints // are implied by earlier constraints. cvc3Context.assume(constraint); } } } cvc3Context.pop(); // Restore the original solver state return newInputs; }
From source file:com.metamx.druid.partition.PartitionHolder.java
public PartitionHolder(PartitionChunk<T> initialChunk) { this.holderSet = Sets.newTreeSet(); add(initialChunk); }
From source file:org.datavyu.plugins.GroupFileFilter.java
@Override public String getDescription() { Set<String> extensions = Sets.newTreeSet(); for (Filter filter : filters) { for (String ext : filter.getExtensions()) { extensions.add(ext);//from w ww . ja v a 2s . co m } } StringBuilder sb = new StringBuilder(description); sb.append(":"); for (String ext : extensions) { sb.append(" "); sb.append(ext); sb.append(","); } if (!extensions.isEmpty()) { // Remove trailing comma. sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
From source file:nl.knaw.huygens.timbuctoo.tools.importer.RelationTypeImporter.java
public RelationTypeImporter(Repository repository) { super(new PrintWriter(System.err), ';', '"'); this.repository = repository; names = Sets.newTreeSet(); }
From source file:org.gradle.cache.internal.VersionSpecificCacheDirectoryScanner.java
public SortedSet<VersionSpecificCacheDirectory> getExistingDirectories() { SortedSet<VersionSpecificCacheDirectory> result = Sets.newTreeSet(); for (File subDir : listVersionSpecificCacheDirs()) { GradleVersion version = tryParseGradleVersion(subDir); if (version != null) { result.add(new VersionSpecificCacheDirectory(subDir, version)); }//ww w .j a va 2 s. c om } return result; }