List of usage examples for com.google.common.collect ImmutableSet copyOf
public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> elements)
From source file:org.jclouds.deltacloud.domain.EnumHardwareProperty.java
public EnumHardwareProperty(String name, String unit, Object value, HardwareParameter param, Set<Object> availableValues) { super(Kind.FIXED, name, unit, value, param); this.availableValues = ImmutableSet.copyOf(checkNotNull(availableValues, "availableValues")); }
From source file:com.facebook.buck.cli.AuditRulesOptions.java
public ImmutableSet<String> getTypes() { return types == null ? ImmutableSet.<String>of() : ImmutableSet.copyOf(types); }
From source file:google.registry.rde.imports.XjcToHostResourceConverter.java
static HostResource convert(XjcRdeHost host) { return new HostResource.Builder().setFullyQualifiedHostName(host.getName()).setRepoId(host.getRoid()) .setCurrentSponsorClientId(host.getClID()).setLastTransferTime(host.getTrDate()) .setCreationTime(host.getCrDate()).setLastEppUpdateTime(host.getUpDate()) .setCreationClientId(host.getCrRr().getValue()) .setLastEppUpdateClientId(host.getUpRr() == null ? null : host.getUpRr().getValue()) .setStatusValues(ImmutableSet.copyOf(Lists.transform(host.getStatuses(), STATUS_VALUE_CONVERTER))) .setInetAddresses(ImmutableSet.copyOf(Lists.transform(host.getAddrs(), ADDR_CONVERTER))).build(); }
From source file:org.apache.aurora.scheduler.filter.ConstraintMatcher.java
/** * Gets the veto (if any) for a scheduling constraint based on the {@link AttributeAggregate} this * filter was created with.//from w ww. j a v a 2 s .co m * * @param constraint Scheduling filter to check. * @return A veto if the constraint is not satisfied based on the existing state of the job. */ static Optional<Veto> getVeto(AttributeAggregate cachedjobState, Iterable<IAttribute> hostAttributes, IConstraint constraint) { Iterable<IAttribute> sameNameAttributes = Iterables.filter(hostAttributes, new NameFilter(constraint.getName())); Optional<IAttribute> attribute; if (Iterables.isEmpty(sameNameAttributes)) { attribute = Optional.absent(); } else { Set<String> attributeValues = ImmutableSet .copyOf(Iterables.concat(Iterables.transform(sameNameAttributes, GET_VALUES))); attribute = Optional.of(IAttribute.build(new Attribute(constraint.getName(), attributeValues))); } ITaskConstraint taskConstraint = constraint.getConstraint(); switch (taskConstraint.getSetField()) { case VALUE: boolean matches = AttributeFilter.matches(attribute.transform(GET_VALUES).or(ImmutableSet.of()), taskConstraint.getValue()); return matches ? Optional.absent() : Optional.of(Veto.constraintMismatch(constraint.getName())); case LIMIT: if (!attribute.isPresent()) { return Optional.of(Veto.constraintMismatch(constraint.getName())); } boolean satisfied = AttributeFilter.matches(attribute.get(), taskConstraint.getLimit().getLimit(), cachedjobState); return satisfied ? Optional.absent() : Optional.of(Veto.unsatisfiedLimit(constraint.getName())); default: throw new SchedulerException( "Failed to recognize the constraint type: " + taskConstraint.getSetField()); } }
From source file:com.opengamma.engine.marketdata.manipulator.CompositeMarketDataSelector.java
/** * Create a composite specification for the specified underlying specifiations. * * @param specifications the specifications to be combined, neither null nor empty * @return a specification combined all the underlying specifications, not null *///from w ww . j a v a 2s. c o m public static MarketDataSelector of(Set<? extends MarketDataSelector> specifications) { return new CompositeMarketDataSelector(ImmutableSet.copyOf(specifications)); }
From source file:org.jclouds.fujitsu.fgcp.domain.VServerWithVNICs.java
public Set<VNIC> getVnics() { return vnics == null ? ImmutableSet.<VNIC>of() : ImmutableSet.copyOf(vnics); }
From source file:org.sosy_lab.cpachecker.cpa.defuse.DefUseState.java
public DefUseState(Set<DefUseDefinition> definitions) { this.definitions = ImmutableSet.copyOf(definitions); }
From source file:co.cask.cdap.logging.pipeline.kafka.KafkaPipelineConfig.java
public KafkaPipelineConfig(String topic, Set<Integer> partitions, long maxBufferSize, long eventDelayMillis, int kafkaFetchBufferSize, long checkpointIntervalMillis) { this.topic = topic; this.partitions = ImmutableSet.copyOf(partitions); this.maxBufferSize = maxBufferSize; this.eventDelayMillis = eventDelayMillis; this.kafkaFetchBufferSize = kafkaFetchBufferSize; this.checkpointIntervalMillis = checkpointIntervalMillis; }
From source file:com.android.build.gradle.internal.api.ReadOnlyVectorDrawablesOptions.java
@Nullable @Override/* ww w . ja va2s .com*/ public Set<String> getGeneratedDensities() { if (mOptions.getGeneratedDensities() == null) { return null; } else { return ImmutableSet.copyOf(mOptions.getGeneratedDensities()); } }
From source file:com.netflix.exhibitor.core.analyze.Analysis.java
Analysis(String error, Collection<PathComplete> completeData, List<Set<String>> possibleCycles) { this.error = error; this.completeData = ImmutableList.copyOf(completeData); ImmutableList.Builder<Set<String>> builder = ImmutableList.builder(); for (Set<String> pc : possibleCycles) { builder.add(ImmutableSet.copyOf(pc)); }/*from w w w . j a v a 2s . c o m*/ this.possibleCycles = builder.build(); }