List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet(Iterable<? extends E> elements)
From source file:org.jclouds.cloudsigma.options.CloneDriveOptions.java
public CloneDriveOptions tags(String... tags) { // Affinity is conveyed using regular tags; make sure to preserve any already-set affinity tag. String currentTagsString = options.remove("tags"); Set<String> currentTags = (currentTagsString == null) ? new HashSet<String>() : Sets.newLinkedHashSet(Splitter.on(' ').split(currentTagsString)); Set<String> newTags = Sets.newLinkedHashSet(); for (String tag : tags) newTags.add(tag);//w w w . jav a2 s .c o m if (currentTags.contains(SSD_AFFINITY_TAG)) newTags.add(SSD_AFFINITY_TAG); options.put("tags", Joiner.on(' ').join(newTags)); return this; }
From source file:edu.udo.scaffoldhunter.plugins.datacalculation.impl.daylightbitstringfingerprint.DaylightBitStringCalcPluginResults.java
@Override public Set<PropertyDefinition> getCalculatedProperties() { return Sets.newLinkedHashSet(Collections.singleton(propDef)); }
From source file:org.obiba.magma.spring.SpringContextScanningDatasource.java
public void dropValueTable(final String name) { if (hasValueTable(name)) { removeValueTable(name);/*from w ww . j a v a 2s.c o m*/ } valueTableFactoryBeans = Sets .newLinkedHashSet(Iterables.filter(valueTableFactoryBeans, new Predicate<ValueTableFactoryBean>() { @Override public boolean apply(ValueTableFactoryBean input) { return !input.getValueTableName().equals(name); } })); // We cannot remove the table from the ValueTableFactoryBeanProvider instances. }
From source file:com.wavemaker.tools.apidocs.tools.core.model.AbstractModel.java
@JsonIgnore public Set<String> getTags() { Object tags = VendorUtils.getWMExtension(this, TAG_EXT); return (tags == null) ? Collections.<String>emptySet() : Sets.newLinkedHashSet((List<String>) tags); }
From source file:org.apache.isis.core.metamodel.facets.CollectionUtils.java
/** * Copies the iterable into the specified type. */// w ww . jav a2s. c o m public static Object copyOf(final Iterable<Object> iterable, final Class<?> requiredType) { if (iterable == null) { throw new IllegalArgumentException("Iterable must be provided"); } if (requiredType == null) { throw new IllegalArgumentException("RequiredType must be provided"); } // specific list implementations if (CopyOnWriteArrayList.class == requiredType) { return Lists.newCopyOnWriteArrayList(iterable); } if (LinkedList.class == requiredType) { return Lists.newLinkedList(iterable); } if (ArrayList.class == requiredType) { return Lists.newArrayList(iterable); } if (AbstractList.class == requiredType) { return Lists.newArrayList(iterable); } // specific set implementations if (CopyOnWriteArraySet.class == requiredType) { return Sets.newCopyOnWriteArraySet(iterable); } if (LinkedHashSet.class == requiredType) { return Sets.newLinkedHashSet(iterable); } if (HashSet.class == requiredType) { return Sets.newHashSet(iterable); } if (TreeSet.class == requiredType) { Iterable rawIterable = iterable; return Sets.newTreeSet(rawIterable); } if (AbstractSet.class == requiredType) { return Sets.newLinkedHashSet(iterable); } // interfaces if (List.class == requiredType) { return Lists.newArrayList(iterable); } if (SortedSet.class == requiredType) { Iterable rawIterable = iterable; return Sets.newTreeSet(rawIterable); } if (Set.class == requiredType) { return Sets.newLinkedHashSet(iterable); } if (Collection.class == requiredType) { return Lists.newArrayList(iterable); } // array if (requiredType.isArray()) { Class<?> componentType = requiredType.getComponentType(); Iterable rawIterable = iterable; return Iterables.toArray(rawIterable, componentType); } // not recognized return null; }
From source file:org.seedstack.seed.web.internal.diagnostic.WebDiagnosticCollector.java
private Map<String, Object> buildServletList() { Map<String, Object> servletMap = new HashMap<>(); for (Map.Entry<String, ? extends ServletRegistration> servletRegistrationEntry : servletContext .getServletRegistrations().entrySet()) { ServletRegistration servletRegistration = servletRegistrationEntry.getValue(); Map<String, Object> servletRegistrationInfo = new HashMap<>(); servletRegistrationInfo.put("class", servletRegistration.getClassName()); servletRegistrationInfo.put("parameters", servletRegistration.getInitParameters()); Collection<String> mappings = servletRegistration.getMappings(); if (mappings == null) { mappings = new ArrayList<>(); }/*from w ww. j a v a 2 s . co m*/ servletRegistrationInfo.put("mappings", Sets.newLinkedHashSet(mappings)); servletMap.put(servletRegistrationEntry.getKey(), servletRegistrationInfo); } return servletMap; }
From source file:org.jclouds.tmrk.enterprisecloud.domain.vm.VirtualMachines.java
private VirtualMachines(Set<VirtualMachine> virtualMachines) { this.virtualMachines = Sets.newLinkedHashSet(virtualMachines); }
From source file:com.google.api.tools.framework.importers.swagger.aspects.auth.AuthRequirementValidator.java
public void reportLogicallyAndedSchemaError(Location location, Map<String, SecurityRequirementModel> securityRequirementsToLogicallyAnd, String authSchemaName, boolean isFromExtension) { Set<String> logicallyAndSchemas = Sets.newLinkedHashSet(securityRequirementsToLogicallyAnd.keySet()); logicallyAndSchemas.add(authSchemaName); diagCollector.addDiag(Diag.error(location, "%s section contains multiple security definitions '%s' within the scope (Security " + "Requirement Object) that get logically ANDed (both requirements need " + "to be satisfied to allow the request). We only support allowing logical OR " + "between security definitions. Therefore, please write requirements in " + "different objects inside the array (which would mean logical OR, that is, any " + "of the requirement should be sufficient to allow the request.)", isFromExtension ? SECURITY_REQUIREMENT_EXTENSION : "security", Joiner.on(",").join(logicallyAndSchemas))); }
From source file:org.jclouds.ibmdev.functions.ParseUtils.java
public static <T> Set<T> clean(Iterable<T> elements, Predicate<T> cleaner) { return Sets.newLinkedHashSet(Iterables.filter(elements, cleaner)); }
From source file:org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContainerMappingHelper.java
/** * Helper for {@link ContainerMapping#getAllNodeMappings()}. The result * should be wrapped in an appropriate EList by users. * //from w w w .jav a 2 s . com * @param self * the container mapping. * @return the node mappings. */ public static Collection<NodeMapping> getAllNodeMappings(ContainerMapping self) { return Sets.union(Sets.newLinkedHashSet(self.getSubNodeMappings()), Sets.newLinkedHashSet(self.getReusedNodeMappings())); }