List of usage examples for com.google.common.collect Sets newHashSet
public static <E> HashSet<E> newHashSet()
From source file:cuchaz.enigma.analysis.EntryRenamer.java
public static <Key, Val> void renameClassesInMultimap(Map<String, String> renames, Multimap<Key, Val> map) { // for each key/value pair... Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); for (Map.Entry<Key, Val> entry : map.entries()) { entriesToAdd.add(new AbstractMap.SimpleEntry<>(renameClassesInThing(renames, entry.getKey()), renameClassesInThing(renames, entry.getValue()))); }//from w w w .ja va2 s. com map.clear(); for (Map.Entry<Key, Val> entry : entriesToAdd) { map.put(entry.getKey(), entry.getValue()); } }
From source file:org.activityinfo.model.form.FormInstanceLabeler.java
public static Set<String> getDuplicatedInstanceLabels(List<FormInstance> list) { final List<String> existingNames = FormInstanceLabeler.getLabels(list); final Set<String> duplicates = Sets.newHashSet(); final Set<String> temp = Sets.newHashSet(); for (String name : existingNames) { if (!temp.add(name)) { duplicates.add(name);/* w ww.j a v a 2s .com*/ } } return duplicates; }
From source file:org.jetbrains.jet.lang.resolve.scopes.JetScopeUtils.java
/** * Get all extension descriptors among visible descriptors for current scope. * * @param scope Scope for query extensions. * @return extension descriptors./*from w ww . j a v a 2s . c o m*/ */ public static Collection<CallableDescriptor> getAllExtensions(@NotNull JetScope scope) { final Set<CallableDescriptor> result = Sets.newHashSet(); for (DeclarationDescriptor descriptor : scope.getAllDescriptors()) { if (descriptor instanceof CallableDescriptor) { CallableDescriptor callDescriptor = (CallableDescriptor) descriptor; if (callDescriptor.getReceiverParameter().exists()) { result.add(callDescriptor); } } } return result; }
From source file:org.jbb.lib.properties.JbbPropertyFilesResolver.java
public Set<String> resolvePropertyFileNames(Class<? extends ModuleStaticProperties> clazz) { Validate.notNull(clazz, "Class cannot be null"); Set<String> result = Sets.newHashSet(); Config.Sources annotation = clazz.getAnnotation(Config.Sources.class); for (String sourceRawString : annotation.value()) { if (fileIsInJbbHome(sourceRawString)) { String resolvedFilePath = resolveFullPath(sourceRawString); result.add(resolvedFilePath); }//from ww w. ja v a 2 s. c o m } return result; }
From source file:ai.grakn.graql.internal.gremlin.Plan.java
static Plan base() { return new Plan(new Stack<>(), new Stack<>(), Sets.newHashSet(), HashMultiset.create(), 0); }
From source file:com.yahoo.yqlplus.engine.rules.NormalizeJoinExpression.java
private Set<String> findSources(final OperatorNode<SequenceOperator> node) { final Set<String> sources = Sets.newHashSet(); node.visit(new OperatorVisitor() { @Override/*from w ww. j a v a 2 s .c o m*/ public <T extends Operator> boolean enter(OperatorNode<T> node) { if (node.getOperator() instanceof SequenceOperator) { return true; } return false; } @Override public <T extends Operator> void exit(OperatorNode<T> node) { if (node.getOperator() instanceof SequenceOperator) { if (node.getAnnotation("alias") != null) { sources.add((String) node.getAnnotation("alias")); } } } }); return sources; }
From source file:io.github.fsm.services.impl.StateManagementServiceImpl.java
public StateManagementServiceImpl() { endStates = Sets.newHashSet(); }
From source file:com.getbase.autoindexer.AutoIndexer.java
public static Set<SqliteIndex> generateIndexes(ModelGraph<? extends DbTableModel> modelGraph) { final Set<SqliteIndex> indexes = Sets.newHashSet(); modelGraph.accept(new RelationshipVisitor<DbTableModel>() { @Override/*from w w w.j a v a2 s.c o m*/ public void visit(OneToManyRelationship<? extends DbTableModel> relationship) { DbTableModel model = relationship.mModel; DbTableModel referencedModel = relationship.mReferencedModel; indexes.add(new SqliteIndex(model.getDbTable(), relationship.mLinkedByColumn)); indexes.add(new SqliteIndex(referencedModel.getDbTable(), relationship.mReferencedModelIdColumn)); } @Override public void visit(OneToOneRelationship<? extends DbTableModel> relationship) { DbTableModel model = relationship.mModel; DbTableModel linkedModel = relationship.mLinkedModel; indexes.add(new SqliteIndex(linkedModel.getDbTable(), relationship.mLinkedByColumn)); indexes.add(new SqliteIndex(model.getDbTable(), relationship.mParentModelIdColumn)); } @Override public void visit(RecursiveModelRelationship<? extends DbTableModel> relationship) { DbTableModel model = relationship.mModel; indexes.add(new SqliteIndex(model.getDbTable(), relationship.mModelIdColumn)); indexes.add(new SqliteIndex(model.getDbTable(), relationship.mGroupByColumn)); } @Override public void visit(ManyToManyRelationship<? extends DbTableModel> relationship) { // no implementation necessary } @Override public void visit(PolymorphicRelationship<? extends DbTableModel> relationship) { DbTableModel model = relationship.mModel; indexes.add(new SqliteIndex(model.getDbTable(), relationship.mTypeColumnName, relationship.mIdColumnName)); for (DbTableModel dbTableModel : relationship.mPolymorphicModels.values()) { indexes.add(new SqliteIndex(dbTableModel.getDbTable(), relationship.mPolymorphicModelIdColumn)); } } }); return indexes; }
From source file:com.playersun.jbf.modules.sys.service.GroupService.java
/** * ???//from w w w .java 2 s .com * * @param userId * @param organizationIds * @return */ public Set<Long> findShowGroupIds(Long userId, Set<Long> organizationIds) { Set<Long> groupIds = Sets.newHashSet(); groupIds.addAll(getGroupRepository().findDefaultGroupIds()); groupIds.addAll(groupRelationService.findGroupIds(userId, organizationIds)); //TODO ? ??? for (Group group : this.findList((Pageable) null)) { if (Boolean.FALSE.equals(group.getIsShow())) { groupIds.remove(group.getId()); } } return groupIds; }
From source file:com.nesscomputing.service.discovery.announce.GalaxyAnnouncer.java
public static final Set<ServiceInformation> buildServices(final AnnouncementConfig announcementConfig, final GalaxyHttpServerConfig httpServerConfig, final GalaxyConfig galaxyConfig) { final Set<ServiceInformation> services = Sets.newHashSet(); final String serviceName = announcementConfig.getServiceName(); if (StringUtils.isBlank(serviceName)) { LOG.warn("No service name given, not announcing anything. This is not what you want!"); } else {/* ww w . ja v a 2 s .co m*/ final String serviceType = announcementConfig.getServiceType(); if (announcementConfig.isAnnounceInternal()) { LOG.debug("Internal services are announced"); services.addAll(buildInternalServices(serviceName, serviceType, httpServerConfig, galaxyConfig)); } if (announcementConfig.isAnnounceExternal()) { LOG.debug("External services are announced"); services.addAll(buildExternalServices(serviceName, serviceType, httpServerConfig, galaxyConfig)); } } LOG.debug("Total number of announcements: %d", services.size()); return services; }