List of usage examples for com.google.common.collect Sets newLinkedHashSet
public static <E> LinkedHashSet<E> newLinkedHashSet(Iterable<? extends E> elements)
From source file:ollie.internal.codegen.Registry.java
public Set<ColumnElement> getColumnElements(TypeElement enclosingType) { return Sets.newLinkedHashSet(columns.get(enclosingType.getQualifiedName().toString())); }
From source file:org.solenopsis.checkstyle.PackageObjectFactory.java
/** * Creates a new {@code PackageObjectFactory} instance. * @param packageNames the list of package names to use * @param moduleClassLoader class loader used to load Checkstyle * core and custom modules/*from www .j a v a2 s .c om*/ */ public PackageObjectFactory(Set<String> packageNames, ClassLoader moduleClassLoader) { if (moduleClassLoader == null) { throw new IllegalArgumentException("moduleClassLoader must not be null"); } //create a copy of the given set, but retain ordering packages = Sets.newLinkedHashSet(packageNames); this.moduleClassLoader = moduleClassLoader; }
From source file:RainbowIRC.Configuration.Configuration.java
/** * Gets keys, not deep by default.//from w w w . j a va2 s.com * * @return top level keys for this section */ public Collection<String> getKeys() { return Sets.newLinkedHashSet(self.keySet()); }
From source file:de.marx_labs.utilities.common.searchtree.MapDBSearchTree.java
@Override public Set<T> findOld(Long term, int size) { Set<T> matches = new LinkedHashSet<T>(); Long key = treeMap.lowerKey(term); for (int i = 0; i < size; i++) { matches.add(treeMap.get(key));/*from w w w. ja va 2 s . c om*/ key = treeMap.lowerKey(key); if (key == null) { break; } } List<T> reverseList = Lists.reverse(Lists.newArrayList(matches)); return Sets.newLinkedHashSet(reverseList); }
From source file:com.gafactory.core.client.ui.suggestions.SuggestedListEditor.java
public SuggestedListEditor(Renderer<T> renderer, final RestDataProxy<T, ID, ?> dataProxy, ValueProvider<T, String> searchField, final ValueProvider<T, ID> idValueProvider) { this.dataProxy = dataProxy; this.idValueProvider = idValueProvider; bagePanel = new BagePanel<T>(renderer); suggestEditor = new SuggestedEditor<T>(renderer, dataProxy, searchField); suggestEditor.addSelectionHandler(new SelectionHandler<T>() { @Override/*from w w w . ja va2 s . com*/ public void onSelection(SelectionEvent<T> event) { suggestEditor.setValue(null); final Set<T> value = Sets.newLinkedHashSet(getValue()); final T item = event.getSelectedItem(); if (item != null) { value.add(item); ArrayList<T> list = Lists.newArrayList(value); setValue(list, true); } } }); bagePanel.addValueChangeHandler(new ValueChangeHandler<List<T>>() { @Override public void onValueChange(ValueChangeEvent<List<T>> event) { updateExcluded(event.getValue()); } }); FlowPanel panel = new FlowPanel(); panel.add(suggestEditor); createAddRemoveAll(dataProxy); Well well = new Well(); well.add(bagePanel); panel.add(well); initWidget(panel); }
From source file:org.jclouds.softlayer.binders.ProductOrderToJson.java
/** * Builds a Json string suitable for sending to the softlayer api * //from w ww . j av a2s.c om * @param order * @return */ String buildJson(ProductOrder order) { Iterable<Price> prices = Iterables.transform(order.getPrices(), new Function<ProductItemPrice, Price>() { @Override public Price apply(ProductItemPrice productItemPrice) { return new Price(productItemPrice.getId()); } }); Iterable<HostnameAndDomain> hosts = Iterables.transform(order.getVirtualGuests(), new Function<VirtualGuest, HostnameAndDomain>() { @Override public HostnameAndDomain apply(VirtualGuest virtualGuest) { return new HostnameAndDomain(virtualGuest.getHostname(), virtualGuest.getDomain()); } }); OrderData data = new OrderData(order.getPackageId(), order.getLocation(), Sets.newLinkedHashSet(prices), Sets.newLinkedHashSet(hosts), order.getQuantity(), order.getUseHourlyPricing()); return json.toJson(ImmutableMap.of("parameters", ImmutableList.<OrderData>of(data))); }
From source file:com.gnapse.metric.Property.java
/** * Creates a new derived property in the given universe with the specified names and * factorization./* ww w.j av a 2 s . co m*/ * * @param universe the universe where this property is defined * @param names the names of this property * @param factors the factors that define this property as a derivation of other properties * @throws MetricException if any of the property names is a duplicate of a property previously * defined, or if there's a property already defined in the universe with the same dimension */ Property(Universe universe, List<String> names, Factorization<Property> factors) throws MetricException { boolean isDerived = (factors != null) && !factors.isEmpty() && !factors.isSingleItem(); checkArgument(names != null && !names.isEmpty()); this.name = Iterables.getFirst(names, null); this.names = Collections.unmodifiableSet(Sets.newLinkedHashSet(names)); this.universe = checkNotNull(universe); this.dimensions = isDerived ? reduceFactors(factors) : Factorization.factor(this, 1); universe.registerNewProperty(this); if (isDerived) { Factorization<Unit> baseUnitFactors = factors.transformItems(getPropertyBaseUnitFn); registerNewUnit(new Unit(this, baseUnitFactors, true)); } }
From source file:au.id.wolfe.fxassetman.server.dao.jpa.GenericDaoImpl.java
@Override @SuppressWarnings("unchecked") public Set<T> findAll() { return Sets.newLinkedHashSet( entityManager.createQuery("SELECT e FROM " + type.getName() + " e").getResultList()); }