List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet()
From source file:co.cask.cdap.common.lang.CombineClassLoader.java
@Override protected Enumeration<URL> findResources(String name) throws IOException { // Using LinkedHashSet to preserve the ordering Set<URL> urls = Sets.newLinkedHashSet(); for (ClassLoader classLoader : delegates) { Iterators.addAll(urls, Iterators.forEnumeration(classLoader.getResources(name))); }/*from w ww . j a v a 2 s . co m*/ return Iterators.asEnumeration(urls.iterator()); }
From source file:org.eclipse.xtext.ide.serializer.impl.ChangeSerializer.java
@Override public void applyModifications(IAcceptor<IEmfResourceChange> changeAcceptor) { monitor.setTaskName("Preparing Text Changes..."); Set<Resource> resources = Sets.newLinkedHashSet(); for (Pair<Notifier, IModification<? extends Notifier>> p : modifications) { Notifier context = p.getFirst(); if (context instanceof EObject) resources.add(((EObject) context).eResource()); else if (context instanceof Resource) resources.add((Resource) context); else if (context instanceof ResourceSet) { throw new IllegalStateException("Not supported"); }/* w w w .ja v a 2 s. c o m*/ } for (Resource res : resources) { // TODO: use the exact context beginRecordChanges(res); } checkCanceled(); for (Pair<Notifier, IModification<? extends Notifier>> entry : modifications) { apply(entry.getFirst(), entry.getSecond()); } checkCanceled(); endRecordChanges(changeAcceptor); }
From source file:org.smartdeveloperhub.harvesters.it.backend.Issue.java
public Issue() { this.tags = Sets.newLinkedHashSet(); this.commits = Sets.newLinkedHashSet(); this.childIssues = Sets.newLinkedHashSet(); this.blockedIssues = Sets.newLinkedHashSet(); this.versions = Sets.newLinkedHashSet(); this.components = Sets.newLinkedHashSet(); }
From source file:org.gradle.api.internal.tasks.compile.incremental.deps.ClassSetAnalysis.java
public DependentsSet getRelevantDependents(Iterable<String> classes, IntSet constants) { Set<String> result = null; for (String cls : classes) { DependentsSet d = getRelevantDependents(cls, constants); if (d.isDependencyToAll()) { return d; }// ww w. ja va 2 s .c o m Set<String> dependentClasses = d.getDependentClasses(); if (dependentClasses.isEmpty()) { continue; } if (result == null) { result = Sets.newLinkedHashSet(); } result.addAll(dependentClasses); } return result == null ? DependentsSet.empty() : DependentsSet.dependents(result); }
From source file:org.napile.compiler.lang.resolve.scopes.WriteThroughScope.java
@Override @NotNull// www . j a va2 s. c o m public Set<VariableDescriptor> getVariables(@NotNull Name name) { checkMayRead(); Set<VariableDescriptor> properties = Sets.newLinkedHashSet(); properties.addAll(writableWorker.getVariables(name)); properties.addAll(getWorkerScope().getVariables(name)); properties.addAll(super.getVariables(name)); //imports return properties; }
From source file:jp.tricreo.schemagenerator.infrastructure.utils.CloneUtil.java
/** * ?? {@link Collection} ???{@link Object#clone() }?? * ??????? {@link LinkedHashSet} ?/*from w ww.j av a 2 s.c o m*/ * * @param <E> ?? * @param collection ??? * @return {@link LinkedHashSet} */ public static <E extends Entity<E, ?>> LinkedHashSet<E> cloneEntityLinkedHashSet(Collection<E> collection) { LinkedHashSet<E> cloneCollection = Sets.newLinkedHashSet(); for (E element : collection) { E cloneElement = element.clone(); cloneCollection.add(cloneElement); } return cloneCollection; }
From source file:org.eclipse.emf.compare.ide.ui.internal.logical.view.LogicalModelViewContentProvider.java
@Override public Object[] getChildren(Object element) { Object[] children = new Object[0]; if (logicalModelView.getPresentation() == Presentation.LIST) { if (!leaves.contains(element)) { children = leaves.toArray(); }/*from www . ja va 2s.c o m*/ } else if (logicalModelView.getPresentation() == Presentation.TREE) { if (element instanceof IContainer) { if (isParentOfALeaf((IContainer) element)) { Object[] tmp = super.getChildren(element); children = getChildren(tmp); } } else if (element instanceof Object[]) { Collection<Object> tmp = Sets.newLinkedHashSet(); Object[] list = (Object[]) element; for (Object object : list) { if (object instanceof IContainer && isParentOfALeaf((IContainer) object)) { tmp.add(object); } else if (leaves.contains(object)) { tmp.add(object); } } children = tmp.toArray(); } else { children = super.getChildren(element); } } return children; }
From source file:org.terasology.assets.management.AssetManager.java
/** * Retrieves a set of the ResourceUrns for all loaded assets of the given Asset class (including subtypes) * * @param type The Asset class of interest * @param <T> The Asset class/*w w w .j a v a 2s.c o m*/ * @return A set of the ResourceUrns of all loaded assets */ public <T extends Asset<?>> Set<ResourceUrn> getLoadedAssetUrns(Class<T> type) { List<AssetType<? extends T, ?>> assetTypes = assetTypeManager.getAssetTypes(type); switch (assetTypes.size()) { case 0: return Collections.emptySet(); case 1: return assetTypes.get(0).getLoadedAssetUrns(); default: Set<ResourceUrn> result = Sets.newLinkedHashSet(); for (AssetType<? extends T, ?> assetType : assetTypes) { result.addAll(assetType.getLoadedAssetUrns()); } return result; } }
From source file:com.intelligentsia.dowsers.entity.meta.provider.MetaEntityProviderAnalyzer.java
/** * @see com.intelligentsia.dowsers.entity.meta.MetaEntityProvider#find(com.intelligentsia.dowsers.entity.reference.Reference) *//*from w w w . j a v a2 s.co m*/ @Override public Collection<MetaEntity> find(final Reference reference) throws NullPointerException { Preconditions.checkNotNull(reference); final Collection<MetaEntity> result = Sets.newLinkedHashSet(); if (reference.isIdentifier()) { return result; } // obtain class information final ClassInformation classInformation = ClassInformation.parse(reference.getEntityClassName()); // analyze final MetaEntity metaEntity = analyze(classInformation); if (metaEntity != null) { if (!metaEntity.metaAttributes().isEmpty()) { result.add(metaEntity); } } return result; }
From source file:org.eclipse.xtext.ui.editor.templates.DefaultTemplateProposalProvider.java
@Override protected TemplateContextType[] getContextTypes(final ContentAssistContext context) { final Set<TemplateContextType> result = Sets.newLinkedHashSet(); IFollowElementAcceptor acceptor = createFollowElementAcceptor(result); List<AbstractElement> grammarElements = context.getFirstSetGrammarElements(); for (AbstractElement element : grammarElements) acceptor.accept(element);/* ww w.ja v a2 s . co m*/ return result.toArray(new TemplateContextType[result.size()]); }