当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableSet.isEmpty方法代码示例

本文整理汇总了Java中com.google.common.collect.ImmutableSet.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableSet.isEmpty方法的具体用法?Java ImmutableSet.isEmpty怎么用?Java ImmutableSet.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.ImmutableSet的用法示例。


在下文中一共展示了ImmutableSet.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extract

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@Nullable
@Override
public ModelSchemaAspectExtractionResult extract(ModelSchemaExtractionContext<?> extractionContext, final List<ModelPropertyExtractionResult<?>> propertyResults) {
    ImmutableSet.Builder<ModelProperty<?>> dimensionsBuilder = ImmutableSet.builder();
    for (ModelPropertyExtractionResult<?> propertyResult : propertyResults) {
        ModelProperty<?> property = propertyResult.getProperty();
        for (PropertyAccessorExtractionContext accessor : propertyResult.getAccessors()) {
            if (accessor.isAnnotationPresent(Variant.class)) {
                if (accessor.getAccessorType() == PropertyAccessorType.SETTER) {
                    throw invalidProperty(extractionContext, property, "@Variant annotation is only allowed on getter methods");
                }
                Class<?> propertyType = property.getType().getRawClass();
                if (!String.class.equals(propertyType) && !Named.class.isAssignableFrom(propertyType)) {
                    throw invalidProperty(extractionContext, property, String.format("@Variant annotation only allowed for properties of type String and %s, but property has type %s", Named.class.getName(), propertyType.getName()));
                }
                dimensionsBuilder.add(property);
            }
        }
    }
    ImmutableSet<ModelProperty<?>> dimensions = dimensionsBuilder.build();
    if (dimensions.isEmpty()) {
        return null;
    }
    return new ModelSchemaAspectExtractionResult(new VariantAspect(dimensions));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:VariantAspectExtractionStrategy.java

示例2: handleUnresolvedClasses

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
 * Identifies and logs all unresolved class names. Then computes the percentage of unresolved
 * classes. If more than a certain threshold are unresolved, then it will throw an
 * IllegalStateException.
 */
private void handleUnresolvedClasses(
    ImmutableSet<String> projectClasses, Set<String> resolvedClasses) {
  Set<String> unresolvedClasses = Sets.difference(projectClasses, resolvedClasses);
  if (unresolvedClasses.isEmpty() || projectClasses.isEmpty()) {
    return;
  }

  logger.severe(
      String.format(
          "Unresolved class names = {\n\t%s\n}", Joiner.on("\n\t").join(unresolvedClasses)));

  if (UNRESOLVED_THRESHOLD * projectClasses.size() < unresolvedClasses.size()) {
    throw new IllegalStateException(
        String.format(
            "BUILD File Generator failed to map over %.0f percent of class names. "
                + "Check your white list and content roots",
            UNRESOLVED_THRESHOLD * 100));
  }
}
 
开发者ID:bazelbuild,项目名称:BUILD_file_generator,代码行数:25,代码来源:ProjectClassToRuleResolver.java

示例3: checkSetsEqual

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@MoveToBUECommon
private static <T> void checkSetsEqual(Set<T> left, String leftName, Set<T> right, String rightName) {
  if (!left.equals(right)) {
    final StringBuilder msg = new StringBuilder();
    msg.append(leftName).append(" should exactly equal ").append(rightName).append(" but ");
    final ImmutableSet<T> leftOnly = Sets.difference(left, right).immutableCopy();
    final ImmutableSet<T> rightOnly = Sets.difference(right, left).immutableCopy();

    if (!leftOnly.isEmpty()) {
      msg.append(leftOnly).append(" are only in ").append(leftName).append(" ");
    }
    if (!rightOnly.isEmpty()) {
      msg.append(rightOnly).append(" are only in ").append(rightName).append(" ");
    }

    throw new IllegalArgumentException(msg.toString());
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:19,代码来源:AnswerKey.java

示例4: parseCharOffsetSpans

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private static ImmutableSet<CharOffsetSpan> parseCharOffsetSpans(final String s) {
  if ("NIL".equals(s)) {
    return ImmutableSet.of();
  }

  final ImmutableSet.Builder<CharOffsetSpan> ret = ImmutableSet.builder();

  for (final String span : onCommas.split(s)) {
    ret.add(TACKBPEALIOUtils.parseCharOffsetSpan(span));
  }

  final ImmutableSet<CharOffsetSpan> spans = ret.build();

  if (spans.isEmpty()) {
    throw new RuntimeException(String.format("Empty spans sets must be indicated by NIL"));
  }

  return spans;
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:20,代码来源:AssessmentSpecFormats.java

示例5: intersectedCopy

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@MoveToBUECommon
private static <T> ImmutableSet<T> intersectedCopy(Iterable<? extends Iterable<? extends T>> iterables) {
  if (Iterables.isEmpty(iterables)) {
    return ImmutableSet.of();
  }

  ImmutableSet<T> ret = null;

  for (final Iterable<? extends T> iterable : iterables) {
    if (ret == null) {
      ret = ImmutableSet.copyOf(iterable);
    } else {
      ret = Sets.intersection(ret, ImmutableSet.copyOf(iterable)).immutableCopy();
    }

    // as soon as we realize the intersection is empty there is no need to do more work
    if (ret.isEmpty()) {
      break;
    }
  }

  return ret;
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:24,代码来源:DerivedQuerySelector2016.java

示例6: renderedTags

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
String[] renderedTags() {
    final StringBuilder sb = new StringBuilder();
    boolean some = false;
    for(Provider<Tagger> provider : taggers.get()) {
        final Tagger tagger;
        try {
            tagger = Injection.unwrappingExceptions(OutOfScopeException.class, provider);
        } catch(OutOfScopeException e) {
            // If the tagger is out of scope, just omit its tags,
            // but log a warning in case this hides an unexpected exception.
            logger.warning("Ignoring out-of-scope tagger (" + e.toString() + ")");
            continue;
        }

        final ImmutableSet<Tag> tags = tagger.tags();
        if(!tags.isEmpty()) {
            if(some) sb.append(',');
            some = true;
            sb.append(tagSetCache.getUnchecked(tags));
        }
    }
    return some ? new String[] {sb.toString()} : EMPTY;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:24,代码来源:DataDogClient.java

示例7: propertyOf

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public static ImmutableSet<?> propertyOf(Blob blob, Function<String, Collection<String>> pathPropertyMapping, PropertyCollectionResolver propertyResolver,
			String propertyName) {
		Collection<String> aliasList = pathPropertyMapping.apply(propertyName);
		for (String alias : aliasList) {
//			if (alias.equals("filename")) {
//				return ImmutableSet.of(blob.filename());
//			}
//			if (alias.equals("path")) {
//				return ImmutableSet.of(Joiner.on('/').join(blob.path()));
//			}
			ImmutableSet<?> resolved = propertyResolver.resolve(blob.meta(), Splitter.on('.').split(alias));
			if (!resolved.isEmpty()) {
				return resolved;
			}
		}
		return ImmutableSet.of();
	}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:18,代码来源:Blobs.java

示例8: copyWithFilteredResponses

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public ResponseLinking copyWithFilteredResponses(final Predicate<Response> toKeepCondition) {
  final Set<Response> newIncompletes = Sets.filter(incompleteResponses(), toKeepCondition);
  final ImmutableSet.Builder<ResponseSet> newResponseSetsB = ImmutableSet.builder();
  final ImmutableBiMap.Builder<String, ResponseSet> responseSetsIdB = ImmutableBiMap.builder();
  // to account for ResponseSets merging due to lost annotation
  final Set<ResponseSet> alreadyAdded = Sets.newHashSet();
  for (final ResponseSet responseSet : responseSets()) {
    final ImmutableSet<Response> okResponses = FluentIterable.from(responseSet.asSet())
        .filter(toKeepCondition).toSet();
    if (!okResponses.isEmpty()) {
      final ResponseSet newResponseSet = ResponseSet.from(okResponses);
      if(alreadyAdded.contains(newResponseSet)) {
        continue;
      }
      alreadyAdded.add(newResponseSet);
      newResponseSetsB.add(newResponseSet);
      if (responseSetIds().isPresent()) {
        responseSetsIdB.put(responseSetIds().get().inverse().get(responseSet), newResponseSet);
      }
    }
  }

  final ImmutableSet<ResponseSet> newResponseSets = newResponseSetsB.build();
  final ResponseLinking.Builder ret = ResponseLinking.builder().docID(docID())
      .responseSets(newResponseSets).incompleteResponses(newIncompletes);
  if (responseSetIds().isPresent()) {
    ret.responseSetIds(responseSetsIdB.build());
  }
  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:31,代码来源:_ResponseLinking.java

示例9: getEventFrameID

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private String getEventFrameID(final ResponseSet responseSet,
    final ResponseLinking responseLinking) throws IOException {
  checkArgument(responseLinking.responseSetIds().isPresent(), "Linking does not assign frame "
      + "IDs. These are required for writing in 2016 format.");
  final ImmutableSet<String> ids =
      responseLinking.responseSetIds().get().asMultimap().inverse().get(responseSet);
  if (ids.size() == 1) {
    return ids.asList().get(0);
  } else if (ids.isEmpty()) {
    throw new IOException("No ID found for event frame " + responseSet);
  } else {
    throw new IOException("Multiple IDs found for event frame, should be impossible: "
        + responseSet);
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:16,代码来源:LinkingStoreSource.java

示例10: filterArguments

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public final DocLevelArgLinking filterArguments(
    Predicate<? super DocLevelEventArg> argPredicate) {
  final DocLevelArgLinking.Builder ret = new DocLevelArgLinking.Builder()
      .docID(docID());
  for (final ScoringEventFrame eventFrame : eventFrames()) {
    final ImmutableSet<DocLevelEventArg> filteredFrame =
        FluentIterable.from(eventFrame).filter(argPredicate).toSet();
    if (!filteredFrame.isEmpty()) {
      ret.addEventFrames(ScoringEventFrame.of(filteredFrame));
    }
  }
  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:14,代码来源:DocLevelArgLinking.java

示例11: processImplicitBindings

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private void processImplicitBindings() {
    for(;;) {
        ImmutableSet<Key<?>> keys = ImmutableSet.copyOf(Sets.difference(requiredKeys, Sets.union(explicitBindings.keySet(), implicitBindings)));
        if(keys.isEmpty()) break;
        for(Key<?> key : keys) {
            if(implicitBindings.add(key)) {
                processInjections(key.getTypeLiteral());
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:12,代码来源:DependencyCollector.java

示例12: getAllAppListings

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
@VisibleForTesting
@SuppressWarnings("GuardedBy")
Optional<ImmutableSet<AppListing>> getAllAppListings(String hostBundleId) {
  Set<AppListing> listings = appIdToListings.values();
  ImmutableSet<String> hostAppIds =
      listings
          .stream()
          .filter(appListing -> appListing.app.applicationBundleId().equals(hostBundleId))
          .map(appListing -> appListing.app.applicationId())
          .collect(ImmutableSet.toImmutableSet());
  Verify.verify(hostAppIds.size() <= 1, "multiple matching host apps: %s", hostAppIds);
  if (!hostAppIds.isEmpty()) {
    String hostAppId = Iterables.getOnlyElement(hostAppIds);
    ImmutableSet<AppListing> childListings =
        listings
            .stream()
            .filter(
                appListing ->
                    hostAppId.equals(appListing.app.optionalHostApplicationId().orNull()))
            .collect(ImmutableSet.toImmutableSet());
    if (!childListings.isEmpty()
        && childListings.stream().allMatch(appListing -> appListing.listing.isPresent())) {
      return Optional.of(childListings);
    }
  }
  return Optional.empty();
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:28,代码来源:InspectorMessenger.java

示例13: indexBlocked

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
public boolean indexBlocked(ClusterBlockLevel level, String index) {
    if (!global(level).isEmpty()) {
        return true;
    }
    ImmutableSet<ClusterBlock> indexBlocks = indices(level).get(index);
    if (indexBlocks != null && !indexBlocks.isEmpty()) {
        return true;
    }
    return false;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:ClusterBlocks.java

示例14: buildCoords

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
private static Stream<MavenCoords> buildCoords(
    final String groupIdBase, final String artifactIdBase, final ImmutableSet<String> modules) {
  if (modules.isEmpty()) {
    return Stream.of(MavenCoords.create(groupIdBase, artifactIdBase));
  } else {
    return modules.stream().map(spec -> formatSpec(groupIdBase, artifactIdBase, spec));
  }
}
 
开发者ID:spotify,项目名称:bazel-tools,代码行数:9,代码来源:MavenDependencies.java

示例15: closeStage

import com.google.common.collect.ImmutableSet; //导入方法依赖的package包/类
/**
 * Closes the current stage.
 */
private void closeStage() {
    ImmutableSet<FlowRuleOperation> stage = currentStage.build();
    if (!stage.isEmpty()) {
        listBuilder.add(stage);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:FlowRuleOperations.java


注:本文中的com.google.common.collect.ImmutableSet.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。