List of usage examples for com.google.common.collect ImmutableSet copyOf
public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> elements)
From source file:com.github.rinde.rinsim.central.GlobalStateObjects.java
public static ImmutableSet<Parcel> unassignedParcels(GlobalStateObject state) { final Set<Parcel> set = newLinkedHashSet(state.getAvailableParcels()); set.removeAll(assignedParcels(state)); return ImmutableSet.copyOf(set); }
From source file:org.eclipse.xtext.xtext.ParameterConfigHelper.java
public static Set<Parameter> getAssignedParameters(AbstractElement element, int parameterConfig) { if (parameterConfig != 0) { ParserRule parserRule = GrammarUtil.containingParserRule(element); Set<Parameter> allParameters = ImmutableSet.copyOf(parserRule.getParameters()); int seen = 0; for (Set<Parameter> candidate : Sets.powerSet(allParameters)) { if (seen == parameterConfig) { return candidate; }/* w w w . java2 s. com*/ seen++; } } return Collections.emptySet(); }
From source file:org.graylog2.rest.models.system.config.ClusterConfigList.java
public static ClusterConfigList create(Collection<String> classes) { return new AutoValue_ClusterConfigList(classes.size(), ImmutableSet.copyOf(classes)); }
From source file:cz.cuni.mff.ms.brodecva.botnicek.ide.utils.data.Comparisons.java
/** * Zjist, zda-li jsou prvky navzjem rzn. * /*from www . ja v a 2s.com*/ * @param elements * prvky * @return zda-li jsou vechny prvky navzjem rzn */ @SafeVarargs public static <E> boolean allDifferent(final E... elements) { Preconditions.checkNotNull(elements); return ImmutableSet.copyOf(elements).size() == elements.length; }
From source file:dagger2.internal.codegen.ResolvedBindings.java
static ResolvedBindings create(BindingKey bindingKey, Set<? extends Binding> ownedBindings, Set<? extends Binding> inheritedBindings) { ImmutableSet<Binding> immutableOwnedBindings = ImmutableSet.copyOf(ownedBindings); return new AutoValue_ResolvedBindings(bindingKey, immutableOwnedBindings, ImmutableSet.<Binding>builder().addAll(inheritedBindings).addAll(immutableOwnedBindings).build()); }
From source file:io.sidecar.util.CollectionUtils.java
public static <T> ImmutableSet<T> filterNulls(Set<T> orig) { if (orig == null) { return ImmutableSet.of(); }/* w w w . java 2 s .c o m*/ return ImmutableSet.copyOf(Iterables.filter(orig, new Predicate<T>() { @Override public boolean apply(T t) { return t != null; } })); }
From source file:org.jclouds.util.Iterables2.java
/** * Copies the contents of a wildcarded {@link Iterable} into a concrete {@link Iterable} of the left bound * /*www.j a v a2 s.c om*/ * @param unboundedValues wildcarded source {@link Iterable} * @return concrete-typed copy of the source */ public static <T> Iterable<T> concreteCopy(Iterable<? extends T> unboundedValues) { // Please do not attempt to sort, as this is wasteful return ImmutableSet.copyOf(unboundedValues); }
From source file:org.gradle.api.internal.tasks.compile.incremental.deps.DependentsSet.java
public static DependentsSet dependents(Set<String> dependentClasses) { if (dependentClasses.isEmpty()) { return empty(); } else {/* w w w .j av a 2 s.com*/ return new DefaultDependentsSet(ImmutableSet.copyOf(dependentClasses)); } }
From source file:io.prestosql.sql.planner.iterative.rule.RemoveRedundantIdentityProjections.java
private static boolean outputsSameAsSource(ProjectNode node) { return ImmutableSet.copyOf(node.getOutputSymbols()) .equals(ImmutableSet.copyOf(node.getSource().getOutputSymbols())); }
From source file:at.ac.univie.isc.asio.tool.Beans.java
/** * Create a copy of given input properties. * * @param input source properties//from www . j a v a 2s . c o m * @param exclude keys of properties that should be omitted * @return map of copied properties */ public static Map<String, String> copyToMap(final Properties input, final String... exclude) { final ImmutableSet<String> excluded = ImmutableSet.copyOf(exclude); final ImmutableMap.Builder<String, String> clone = ImmutableMap.builder(); for (String key : input.stringPropertyNames()) { if (!excluded.contains(key)) { clone.put(key, input.getProperty(key)); } } return clone.build(); }