List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet()
From source file:org.eclipse.buildship.core.workspace.internal.BuildCommandUpdater.java
private static Set<ICommand> toCommands(Optional<List<OmniEclipseBuildCommand>> buildCommands, IProjectDescription description) { Set<ICommand> commands = Sets.newLinkedHashSet(); if (buildCommands.isPresent()) { commands.addAll(toCommands(buildCommands.get(), description)); } else {/*from ww w .ja v a 2 s . c om*/ commands.addAll(Arrays.asList(description.getBuildSpec())); } commands.add(toCommand(description, GradleProjectBuilder.ID, Collections.<String, String>emptyMap())); return commands; }
From source file:org.cinchapi.concourse.util.TSets.java
/** * Return a Set that contains only the elements that are in both {@code a} * and {@code b}.// ww w .j a v a2 s. c o m * * @param a * @param b * @return the intersection of the Sets */ public static <T> Set<T> intersection(Set<T> a, Set<T> b) { Set<T> intersection = Sets.newLinkedHashSet(); Set<T> smaller = a.size() <= b.size() ? a : b; Set<T> larger = Sets.newHashSet(a.size() > b.size() ? a : b); for (T element : smaller) { if (larger.contains(element)) { intersection.add(element); } } return intersection; }
From source file:org.apache.isis.core.runtime.services.DeweyOrderUtil.java
static <V> List<Map.Entry<String, V>> deweySorted(Map<String, V> map) { Set<Map.Entry<String, V>> set = Sets.newLinkedHashSet(); for (Map.Entry<String, V> entry : map.entrySet()) { set.add(entry);/* w ww .ja va2 s . c o m*/ } return deweySorted(set); }
From source file:org.jetbrains.jet.lang.resolve.OverridingUtil.java
public static <D> Set<D> filterOverrides(Set<D> candidateSet, Function<? super D, ? extends CallableDescriptor> transform) { Set<D> candidates = Sets.newLinkedHashSet(); outerLoop: for (D meD : candidateSet) { CallableDescriptor me = transform.fun(meD); for (D otherD : candidateSet) { CallableDescriptor other = transform.fun(otherD); if (me == other) continue; if (overrides(other, me)) { continue outerLoop; }//from w ww. jav a 2 s . c o m } for (D otherD : candidates) { CallableDescriptor other = transform.fun(otherD); if (me.getOriginal() == other.getOriginal() && isOverridableBy(other, me).getResult() == OverrideCompatibilityInfo.Result.OVERRIDABLE && isOverridableBy(me, other).getResult() == OverrideCompatibilityInfo.Result.OVERRIDABLE) { continue outerLoop; } } // System.out.println(me); candidates.add(meD); } // Set<D> candidates = Sets.newLinkedHashSet(candidateSet); // for (D descriptor : candidateSet) { // Set<CallableDescriptor> overriddenDescriptors = Sets.newHashSet(); // getAllOverriddenDescriptors(descriptor.getOriginal(), overriddenDescriptors); // candidates.removeAll(overriddenDescriptors); // } return candidates; }
From source file:org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.PendingDependencies.java
PendingDependencies() { this.affectedComponents = Sets.newLinkedHashSet(); this.hardEdges = 0; }
From source file:org.napile.idea.plugin.module.ModuleCollector.java
public static AnalyzeContext getAnalyzeContext(@NotNull final Project project, @Nullable final NapileFile rootFile, final boolean test, @NotNull Module module) { final Set<NapileFile> analyzeFiles = Sets.newLinkedHashSet(); final SmartList<VirtualFile> bootpath = new SmartList<VirtualFile>(); final SmartList<VirtualFile> classpath = new SmartList<VirtualFile>(); ModuleRootManager rootManager = ModuleRootManager.getInstance(module); for (OrderEntry orderEntry : rootManager.getOrderEntries()) { orderEntry.accept(new RootPolicy<Object>() { @Override//from w ww .jav a 2 s . c om public Object visitLibraryOrderEntry(LibraryOrderEntry libraryOrderEntry, Object value) { for (VirtualFile v : libraryOrderEntry.getFiles(OrderRootType.SOURCES)) { classpath.add(v); } return null; } @Override public Object visitModuleJdkOrderEntry(ModuleExtensionWithSdkOrderEntry sdkOrderEntry, Object value) { Sdk sdk = sdkOrderEntry.getSdk(); if (sdk != null && sdk.getSdkType() instanceof NapileSdkType) { VirtualFile lib = sdk.getHomeDirectory().findChild("lib"); if (lib != null) { bootpath.add(lib); } } return null; } @Override public Object visitModuleSourceOrderEntry(ModuleSourceOrderEntry moduleSourceOrderEntry, Object value) { collectSourcesInModule(project, moduleSourceOrderEntry.getOwnerModule(), test, analyzeFiles, rootFile); return null; } @Override public Object visitModuleOrderEntry(ModuleOrderEntry moduleOrderEntry, Object value) { Module module = moduleOrderEntry.getModule(); if (module == null || !moduleOrderEntry.isExported()) return null; collectSourcesInModule(project, module, test, analyzeFiles, rootFile); return null; } }, null); } if (rootFile != null) analyzeFiles.add(rootFile); return new AnalyzeContext(analyzeFiles, bootpath, classpath); }
From source file:de.matzefratze123.heavyspleef.core.module.ModuleManager.java
public ModuleManager() { this.modules = Sets.newLinkedHashSet(); }
From source file:org.gradle.api.reporting.dependents.internal.DependentComponentsUtils.java
public static Set<ComponentSpec> getAllComponents(ModelRegistry registry) { Set<ComponentSpec> components = Sets.newLinkedHashSet(); ComponentSpecContainer componentSpecs = modelElement(registry, "components", ComponentSpecContainer.class); if (componentSpecs != null) { components.addAll(componentSpecs.values()); }/*www . j av a 2s.c o m*/ return components; }
From source file:org.eclipse.sirius.common.tools.api.interpreter.IInterpreterContextUtils.java
/** * Configure the given {@link IInterpreter} instance with the metamodels, * dependencies and scope settings provided by the * {@link IInterpreterContext}./*from w w w . jav a2s . c o m*/ * * @param interpreter * the interpreter to configure. * @param context * the context holding the settings. */ public static void configureInterpreter(IInterpreter interpreter, IInterpreterContext context) { Set<String> projectsOrBundleInScope = collectProjectsOrPlugins(context); interpreter.setProperty(IInterpreter.FILES, projectsOrBundleInScope); Collection<MetamodelDescriptor> availableMetamodels = Sets.newLinkedHashSet(); for (EPackage pak : context.getAvailableEPackages()) { if (pak != null && pak.eResource() != null) { availableMetamodels.add(new EcoreMetamodelDescriptor(pak)); } } interpreter.activateMetamodels(availableMetamodels); interpreter.clearImports(); for (String dependency : context.getDependencies()) { interpreter.addImport(dependency); } }
From source file:org.eclipse.xtext.resource.FileExtensionProvider.java
@Inject protected void setExtensions(@Named(Constants.FILE_EXTENSIONS) String extensions) { String[] split = extensions.split(","); this.fileExtensions = Sets.newLinkedHashSet(); for (String string : split) { this.fileExtensions.add(string); }//from www . ja v a 2s . c o m }