本文整理汇总了Java中com.google.common.collect.ImmutableSet.copyOf方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSet.copyOf方法的具体用法?Java ImmutableSet.copyOf怎么用?Java ImmutableSet.copyOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableSet
的用法示例。
在下文中一共展示了ImmutableSet.copyOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PropertyEnum
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
protected PropertyEnum(String name, Class<T> valueClass, Collection<T> allowedValues)
{
super(name, valueClass);
this.allowedValues = ImmutableSet.copyOf(allowedValues);
for (T t : allowedValues)
{
String s = ((IStringSerializable)t).getName();
if (this.nameToValue.containsKey(s))
{
throw new IllegalArgumentException("Multiple values have the same name \'" + s + "\'");
}
this.nameToValue.put(s, t);
}
}
示例2: validate
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public void validate()
{
if( checkDuplication || forceUnique )
{
final Set<String> values = new HashSet<String>();
for( NameValue nv : namesValues )
{
// nv.value is URL encoded, but the name is ok to use
values.add(nv.getName());
}
final ImmutableCollection<String> valuesReadonly = ImmutableSet.copyOf(values);
// We need to inform the wizard to check for uniqueness every time,
// no matter what
final boolean isUnique = getRepository().checkDataUniqueness(getFirstTarget().getXoqlPath(),
valuesReadonly, !forceUnique);
setInvalid(forceUnique && !isUnique && !isInvalid(),
new KeyLabel("wizard.controls.editbox.uniqueerror")); //$NON-NLS-1$
}
}
示例3: PropertyInteger
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
protected PropertyInteger(String name, int min, int max)
{
super(name, Integer.class);
if (min < 0)
{
throw new IllegalArgumentException("Min value of " + name + " must be 0 or greater");
}
else if (max <= min)
{
throw new IllegalArgumentException("Max value of " + name + " must be greater than min (" + min + ")");
}
else
{
Set<Integer> set = Sets.<Integer>newHashSet();
for (int i = min; i <= max; ++i)
{
set.add(Integer.valueOf(i));
}
this.allowedValues = ImmutableSet.copyOf(set);
}
}
示例4: OpticalPathIntent
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private OpticalPathIntent(ApplicationId appId,
Key key,
ConnectPoint src,
ConnectPoint dst,
Path path,
OchSignal lambda,
OchSignalType signalType,
boolean isBidirectional,
int priority) {
super(appId, key, ImmutableSet.copyOf(path.links()), priority);
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
this.path = checkNotNull(path);
this.lambda = checkNotNull(lambda);
this.signalType = checkNotNull(signalType);
this.isBidirectional = isBidirectional;
}
示例5: DefaultVariantsMetaData
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private DefaultVariantsMetaData(Map<String, Object> variantCoordinates, Map<String, ModelType<?>> variantAxisTypes) {
this.variantCoordinates = variantCoordinates;
this.allVariantAxes = variantCoordinates.keySet();
this.nonNullVariantAxes = ImmutableSet.copyOf(Maps.filterEntries(variantCoordinates, new Predicate<Map.Entry<String, Object>>() {
@Override
public boolean apply(Map.Entry<String, Object> input) {
return input.getValue()!=null;
}
}).keySet());
this.variantAxisTypes = variantAxisTypes;
}
示例6: visit
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public RelNode visit(LogicalFilter filter) {
final RelNode input = filter.getInput().accept(this);
return new LogicalFilter(
cluster,
copyOf(filter.getTraitSet()),
input,
copyOf(filter.getCondition()),
ImmutableSet.copyOf(filter.getVariablesSet())
);
}
示例7: CreateProjectRequest
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@JsonCreator
public CreateProjectRequest(@JsonProperty("name") String name,
@JsonProperty("owners") @Nullable Set<String> owners,
@JsonProperty("members") @Nullable Set<String> members) {
this.name = validateProjectName(name, "name");
this.owners = owners != null ? ImmutableSet.copyOf(owners) : ImmutableSet.of();
this.members = members != null ? ImmutableSet.copyOf(members) : ImmutableSet.of();
}
示例8: unsupportedIdpsForATransaction
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private List<IdentityProviderConfigEntityData> unsupportedIdpsForATransaction(Set<IdentityProviderConfigEntityData> identityProviderConfigEntityData, TransactionConfigEntityData transactionConfigEntityData) {
Set<LevelOfAssurance> transactionLOAs = ImmutableSet.copyOf(transactionConfigEntityData.getLevelsOfAssurance());
return identityProviderConfigEntityData.stream()
.filter(idp -> isIdpForTransaction(transactionConfigEntityData, idp))
.filter(idp -> idpCannotFulfillLoaRequirements(transactionLOAs, idp))
.collect(Collectors.toList());
}
示例9: buildLookup
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private static PodCIDRLookup buildLookup(Set<String> nodeNames,
Map<String, Map<String, String>> netmaskToNetworkToNode) {
ImmutableList.Builder<ImmutablePair<Netmask, ImmutableMap<NetworkAddress, String>>> builder =
ImmutableList.builder();
for (Map.Entry<String, Map<String, String>> entry : netmaskToNetworkToNode.entrySet()) {
Netmask netmask = new Netmask(entry.getKey());
ImmutableMap.Builder<NetworkAddress, String> networkToNodeBuilder = ImmutableMap.builder();
for (Map.Entry<String, String> networkToNode : entry.getValue().entrySet()) {
networkToNodeBuilder.put(new NetworkAddress(networkToNode.getKey()),
networkToNode.getValue());
}
builder.add(ImmutablePair.of(netmask, networkToNodeBuilder.build()));
}
return new PodCIDRLookup(builder.build(), ImmutableSet.copyOf(nodeNames));
}
示例10: queryTunnel
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public Collection<Tunnel> queryTunnel(Tunnel.Type type) {
Collection<Tunnel> result = new HashSet<Tunnel>();
for (TunnelId tunnelId : tunnelIdAsKeyStore.keySet()) {
result.add(tunnelIdAsKeyStore.get(tunnelId));
}
return result.size() == 0 ? Collections.emptySet() : ImmutableSet.copyOf(result);
}
示例11: EntityStore
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public EntityStore(EntityDefinition<E> entityDefinition, Map<RelationDefinition, RelationStore> relationStores) {
m_entityDefinition = entityDefinition;
m_entityClass = entityDefinition.getEntityClass();
m_entityName = entityDefinition.getEntityName();
IdDefinition idDefinition = entityDefinition.getIdDefinition();
m_idPropertyName = idDefinition != null ? idDefinition.getIdName() : null;
m_attributes = ImmutableSet
.copyOf(entityDefinition.getAttributes().values().stream().map(AttributeDefinition::getAttributeName).collect(Collectors.toList()));
ImmutableMap.Builder<String, Map<Object, Long>> uniquesIndex = ImmutableMap.builder();
entityDefinition.getUniqueConstraints().forEach(uniqueAttribute -> uniquesIndex.put(uniqueAttribute, new HashMap<>()));
m_uniquesIndex = uniquesIndex.build();
ImmutableSet.Builder<String> nonNullAttributes = ImmutableSet.builder();
entityDefinition.getAttributes().values().stream() //
.filter(attributeDefinition -> !attributeDefinition.isNullable()) //
.forEach(attributeDefinition -> nonNullAttributes.add(attributeDefinition.getAttributeName()));
m_nonNullAttributes = nonNullAttributes.build();
ImmutableMap.Builder<String, RelationStore> relationStoresBuilder = ImmutableMap.builder();
entityDefinition.getRelations().values().forEach(relationDefinition -> {
RelationStore relationStore = relationStores.get(relationDefinition);
relationStoresBuilder.put(relationDefinition.getRelationName(), relationStore);
});
m_relationStores = relationStoresBuilder.build();
}
示例12: answers
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public Set<Response> answers(final Answerable answerable) {
return ImmutableSet.copyOf(equivalenceClasses.get(answerable));
}
示例13: registerCallsToConstructor
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
void registerCallsToConstructor(Collection<JavaConstructorCall> calls) {
this.callsToSelf = ImmutableSet.copyOf(calls);
}
示例14: validRolesFor
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public ImmutableSet<Symbol> validRolesFor(Symbol type) {
checkNotNull(type);
return ImmutableSet.copyOf(concat(validRoles.get(type), alwaysValidRoles));
}
示例15: statusChangeListeners
import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Override
public Collection<Consumer<Status>> statusChangeListeners() {
return ImmutableSet.copyOf(statusChangeListeners);
}