List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet()
From source file:org.terasology.world.block.loader.AutoBlockProvider.java
@Override public Set<ResourceUrn> getAvailableAssetUrns() { Set<ResourceUrn> result = Sets.newLinkedHashSet(); assetManager.getAvailableAssets(BlockTile.class).stream() .map(urn -> assetManager.getAsset(urn, BlockTile.class).get()).filter(BlockTile::isAutoBlock) .forEach(tile -> result.add(tile.getUrn())); return result; }
From source file:org.apache.lens.server.query.collect.DefaultQueryCollection.java
public DefaultQueryCollection() { this.queries = Sets.newLinkedHashSet(); }
From source file:caveworld.core.ConfigHelper.java
public static String[] getStringsFromItems(Collection<ItemStack> items) { Set<String> ret = Sets.newLinkedHashSet(); for (ItemStack itemstack : items) { if (itemstack != null && itemstack.getItem() != null) { String name = GameData.getItemRegistry().getNameForObject(itemstack.getItem()); int damage = itemstack.getItemDamage(); if (itemstack.isItemStackDamageable()) { ret.add(name);/*w ww . j ava2 s .c o m*/ } else if (itemstack.getHasSubtypes() || damage > 0) { ret.add(name + ":" + damage); } else { ret.add(name); } } } return ret.toArray(new String[ret.size()]); }
From source file:org.apache.isis.applib.ModuleAbstract.java
@Override @XmlTransient public Set<Module> getDependencies() { return Sets.newLinkedHashSet(); }
From source file:de.cosmocode.palava.maven.ipcstub.GenPackage.java
/** * Parses the given commands./*from w w w . j a v a2 s .c om*/ * * @param classes all commands to process * @param parent the parent package * @return the new tree structure * @throws MojoExecutionException if execution failed */ protected static Set<GenPackage> getFirstPackages(Set<Class<? extends IpcCommand>> classes, GenPackage parent) throws MojoExecutionException { final Set<GenPackage> packages = Sets.newLinkedHashSet(); for (Class<? extends IpcCommand> command : classes) { // within the right package? String className; if (parent != null) { if (!command.getName().startsWith(parent.getFullName() + ".")) { // not within the requested package continue; } else { // strip the parents package className = command.getName().substring(parent.getFullName().length() + 1); } } else { className = command.getName(); } // we just need the first element final int index = className.indexOf("."); if (index == 0) { throw new MojoExecutionException("invalid class definition found: " + command.getName()); } else if (index == -1) { Preconditions.checkNotNull(parent, "Parent"); parent.addCommand(new GenCommand(command)); } else { // found a package, do we have it already? final String pkgName = command.getName().substring(0, command.getName().length() - className.length() + index); boolean found = false; for (GenPackage pkg : packages) { if (pkg.getFullName().equals(pkgName)) { found = true; break; } } if (!found) { // we don't have it, create it final GenPackage genPackage = new GenPackage(pkgName, parent); for (GenPackage pkg : getFirstPackages(classes, genPackage)) { genPackage.addPackage(pkg); } packages.add(genPackage); } } } return packages; }
From source file:org.eclipse.emf.compare.ide.ui.internal.logical.view.EMFCompareEditorLMVHandler.java
/** * Retrieve the files associated with the given editor (via its {@link IWorkbenchPart}). * /*from w w w . j a v a 2 s . c om*/ * @param part * the {@link IWorkbenchPart} of the editor. * @param selection * the {@link ISelection}. * @return the files associated with the given editor (via its {@link IWorkbenchPart}). */ @Override public Collection<IFile> getFiles(IWorkbenchPart part, ISelection selection) { final Set<IFile> files = Sets.newLinkedHashSet(); if (part instanceof IEditorPart) { final IEditorInput editorInput = ((IEditorPart) part).getEditorInput(); if (editorInput instanceof CompareEditorInput) { final Object compareResult = ((CompareEditorInput) editorInput).getCompareResult(); if (compareResult instanceof ICompareInput) { final IFile left = findFile(((ICompareInput) compareResult).getLeft()); final IFile right = findFile(((ICompareInput) compareResult).getRight()); final IFile ancestor = findFile(((ICompareInput) compareResult).getAncestor()); if (left != null) { files.add(left); } if (right != null) { files.add(right); } if (ancestor != null) { files.add(ancestor); } } } } return files; }
From source file:org.eclipse.sirius.business.internal.query.DAnalysisesInternalQuery.java
/** * Return all valid (i.e. not null) analyses owned or referenced by the * given collection of analyses./* www . j a va2 s . co m*/ * * @return all valid (i.e. not null) analyses owned or referenced by the * given collection of analyses */ public Collection<DAnalysis> getAllAnalyses() { Collection<DAnalysis> analysisAndReferenced = Sets.newLinkedHashSet(); for (final DAnalysis analysis : new ArrayList<DAnalysis>(analysises)) { /* analysis could be null */ if (analysis != null) { analysisAndReferenced.add(analysis); addAllReferencedAnalyses(analysisAndReferenced, analysis); } } return analysisAndReferenced; }
From source file:uk.ac.ebi.atlas.experimentimport.experimentdesign.magetab.MicroarrayExperimentMageTabParser.java
@Override protected Set<NamedSdrfNode<HybridizationNode>> getAssayNodes(SDRF sdrf) { Set<NamedSdrfNode<HybridizationNode>> namedSdrfNodes = Sets.newLinkedHashSet(); Collection<? extends HybridizationNode> hybridizationNodes = sdrf.getNodes(HybridizationNode.class); if (hybridizationNodes.size() == 0) { //this is required because of a bug in limpopo... hybridizationNodes = sdrf.getNodes(uk.ac.ebi.arrayexpress2.magetab.datamodel.sdrf.node.AssayNode.class); }//w ww.ja va 2 s. co m for (HybridizationNode node : hybridizationNodes) { namedSdrfNodes.add(new NamedSdrfNode<>(node.getNodeName(), node)); } return namedSdrfNodes; }
From source file:de.tu_berlin.dima.oligos.DenseSchema.java
public Set<String> schemas() { Set<String> schemas = Sets.newLinkedHashSet(); for (ColumnId column : columns) { String schema = column.getSchema(); schemas.add(schema);//from w w w.j av a2s .co m } return schemas; }
From source file:org.apache.hive.common.util.ACLConfigurationParser.java
public ACLConfigurationParser(Configuration conf, String confPropertyName) { allowedUsers = Sets.newLinkedHashSet(); allowedGroups = Sets.newLinkedHashSet(); parse(conf, confPropertyName); }