List of usage examples for com.google.common.collect ImmutableSet builder
public static <E> Builder<E> builder()
From source file:com.facebook.buck.testutil.integration.ApkInspector.java
public ApkInspector(File apkFile) throws IOException { this.apkFile = Preconditions.checkNotNull(apkFile); final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); try (ZipFile zipFile = new ZipFile(apkFile)) { Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { builder.add(entries.nextElement().getName()); }// w ww . j a va 2 s .co m } this.apkFileEntries = builder.build(); }
From source file:com.stackframe.sarariman.taskassignments.DefaultTaskAssignmentsImpl.java
public Set<DefaultTaskAssignment> getAll() { try {/*from w w w .j a va 2 s . c o m*/ Connection connection = dataSource.getConnection(); try { Statement s = connection.createStatement(); try { ResultSet r = s.executeQuery("SELECT task FROM default_task_assignment"); try { ImmutableSet.Builder<DefaultTaskAssignment> builder = ImmutableSet .<DefaultTaskAssignment>builder(); while (r.next()) { builder.add(get(tasks.get(r.getInt("task")))); } return builder.build(); } finally { r.close(); } } finally { s.close(); } } finally { connection.close(); } } catch (SQLException se) { throw new RuntimeException(se); } }
From source file:com.google.template.soy.conformance.BannedHtmlTag.java
BannedHtmlTag(Collection<String> bannedTagNames, SoyErrorKind error) { super(error); ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (String tagName : bannedTagNames) { // According to https://www.w3.org/TR/html5/syntax.html#syntax-tag-name, tag names are all // case-insensitive. builder.add(Ascii.toLowerCase(tagName)); }//w w w. ja v a 2 s . com this.bannedTagNames = builder.build(); }
From source file:com.tngtech.archunit.library.plantuml.JavaClassDiagramAssociation.java
JavaClassDiagramAssociation(PlantUmlDiagram diagram) { ImmutableSet.Builder<AssociatedComponent> components = ImmutableSet.builder(); validateStereotypes(diagram);// w w w. j a v a 2 s . c o m for (PlantUmlComponent component : diagram.getAllComponents()) { components.add(new AssociatedComponent(component)); } this.components = components.build(); }
From source file:es.udc.pfc.gamelib.chess.pieces.ChessBishop.java
@Override public ImmutableSet<Position> getStandardMoves(final ChessBoard board) { final ImmutableSet.Builder<Position> moves = ImmutableSet.builder(); moves.addAll(getMovesTo(board, Direction.NE)); moves.addAll(getMovesTo(board, Direction.NW)); moves.addAll(getMovesTo(board, Direction.SE)); moves.addAll(getMovesTo(board, Direction.SW)); return moves.build(); }
From source file:org.gradle.api.internal.changedetection.state.IgnoringResourceFilter.java
public IgnoringResourceFilter(Set<String> ignores) { this.ignores = ImmutableSet.copyOf(ignores); ImmutableSet.Builder<PathMatcher> builder = ImmutableSet.builder(); for (String ignore : ignores) { PathMatcher matcher = PatternMatcherFactory.compile(true, ignore); builder.add(matcher);/*from ww w . j av a 2 s.co m*/ } this.ignoreMatchers = builder.build(); }
From source file:org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl.java
private static Set<String> createAllShardNames(Iterable<ModuleConfig> moduleConfigs) { final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (ModuleConfig moduleConfig : moduleConfigs) { builder.addAll(moduleConfig.getShardNames()); }/*from www .java2s . co m*/ return builder.build(); }
From source file:org.geogit.api.plumbing.DescribeFeatureType.java
/** * Retrieves the set of property descriptors for the given feature type. * /*from w w w.j a va 2s. co m*/ * @return a sorted set of all the property descriptors of the feature type. */ @Override public ImmutableSet<PropertyDescriptor> call() { Preconditions.checkState(featureType != null, "FeatureType has not been set."); FeatureType type = featureType.type(); ImmutableSet.Builder<PropertyDescriptor> propertySetBuilder = new ImmutableSet.Builder<PropertyDescriptor>(); propertySetBuilder.addAll(type.getDescriptors()); return propertySetBuilder.build(); }
From source file:org.seedstack.seed.web.internal.security.shiro.FilterChainResolverProvider.java
public FilterChainResolverProvider(Map<String, ShiroWebModule.FilterKey[]> chains) { this.chains = chains; ImmutableSet.Builder<Dependency<?>> dependenciesBuilder = ImmutableSet.builder(); for (String chain : chains.keySet()) { for (ShiroWebModule.FilterKey filterKey : chains.get(chain)) { dependenciesBuilder.add(Dependency.get(filterKey.getKey())); }// ww w . j a v a2 s. c o m } this.dependencies = dependenciesBuilder.build(); }
From source file:org.seedstack.seed.web.security.internal.shiro.FilterChainResolverProvider.java
public FilterChainResolverProvider(Map<String, ShiroWebModule.FilterKey[]> chains) { this.chains = chains; ImmutableSet.Builder<Dependency<?>> dependenciesBuilder = ImmutableSet.builder(); for (ShiroWebModule.FilterKey[] values : chains.values()) { for (ShiroWebModule.FilterKey filterKey : values) { dependenciesBuilder.add(Dependency.get(filterKey.getKey())); }//from w w w . j a v a 2s .c om } this.dependencies = dependenciesBuilder.build(); }