本文整理汇总了Java中com.google.common.collect.Iterables.any方法的典型用法代码示例。如果您正苦于以下问题:Java Iterables.any方法的具体用法?Java Iterables.any怎么用?Java Iterables.any使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Iterables
的用法示例。
在下文中一共展示了Iterables.any方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeViewPropertyDslMethods
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private void writeViewPropertyDslMethods(ClassVisitor visitor, Type generatedType, Collection<ModelProperty<?>> viewProperties, Class<?> viewClass) {
boolean writable = Iterables.any(viewProperties, new Predicate<ModelProperty<?>>() {
@Override
public boolean apply(ModelProperty<?> viewProperty) {
return viewProperty.isWritable();
}
});
// TODO:LPTR Instead of the first view property, we should figure out these parameters from the actual property
ModelProperty<?> firstProperty = viewProperties.iterator().next();
writeConfigureMethod(visitor, generatedType, firstProperty, writable);
writeSetMethod(visitor, generatedType, firstProperty);
writeTypeConvertingSetter(visitor, generatedType, viewClass, firstProperty);
// TODO - this should be applied to all methods, including delegating methods
writeReadOnlySetter(visitor, viewClass, writable, firstProperty);
}
示例2: isLayoutFile
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public boolean isLayoutFile(@Nullable final FileObject fo) {
if (fo == null || !"xml".equals(fo.getExt())) {
return false;
}
Project p = FileOwnerQuery.getOwner(fo);
if (p.getLookup().lookup(GradleAndroidClassPathProvider.class) == null) {
return false;
}
return Iterables.any(
Arrays.asList(ProjectUtils.getSources(p).getSourceGroups(AndroidConstants.SOURCES_TYPE_ANDROID_RES)),
new Predicate<SourceGroup>() {
@Override
public boolean apply(SourceGroup t) {
FileObject folder = fo.getParent();
if (folder == null) {
return false;
}
return FileUtil.isParentOf(t.getRootFolder(), fo)
&& "xml".equals(fo.getExt())
&& ("layout".equals(folder.getNameExt()) || folder.getNameExt().startsWith("layout-"));
}
});
}
示例3: of
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public static DependentComponentsRenderableDependency of(ComponentSpec componentSpec, ComponentSpecInternal internalProtocol, LinkedHashSet<DependentComponentsRenderableDependency> children) {
ComponentSpecIdentifier id = internalProtocol.getIdentifier();
String name = DependentComponentsUtils.getBuildScopedTerseName(id);
String description = componentSpec.getDisplayName();
boolean buildable = true;
if (componentSpec instanceof VariantComponentSpec) {
// Consider variant aware components with no buildable binaries as non-buildables
VariantComponentSpec variantComponentSpec = (VariantComponentSpec) componentSpec;
buildable = Iterables.any(variantComponentSpec.getBinaries().values(), new Predicate<BinarySpec>() {
@Override
public boolean apply(BinarySpec binarySpec) {
return binarySpec.isBuildable();
}
});
}
boolean testSuite = false;
return new DependentComponentsRenderableDependency(id, name, description, buildable, testSuite, children);
}
示例4: isDirectPolyfill
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
* Returns true if the given container type is a polyfill of the bottom type.
* <p>
* Note: we compare via FQN here, since the bottom type may not stem from the index but from the type model
* derived from the AST. In that case, the type instance, although similar, differs from the type instance
* from the index.
*/
private boolean isDirectPolyfill(ContainerType<?> containerType) {
if (!containerType.isStaticPolyfill() || !(bottomType instanceof TClassifier)) {
return false;
}
QualifiedName qn = N4TSQualifiedNameProvider.getStaticPolyfillFQN((TClassifier) bottomType,
qualifiedNameProvider);
if (containerType instanceof TClass) { // short cut
return qn.equals(qualifiedNameProvider.getFullyQualifiedName(containerType));
}
if (containerType instanceof TN4Classifier) {
return Iterables.any(((TN4Classifier) containerType).getSuperClassifierRefs(),
ref -> qn.equals(qualifiedNameProvider.getFullyQualifiedName(ref.getDeclaredType())));
}
return false;
}
示例5: hasLiveData
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public boolean hasLiveData(int nowInSec)
{
if (primaryKeyLivenessInfo().isLive(nowInSec))
return true;
return Iterables.any(cells(), cell -> cell.isLive(nowInSec));
}
示例6: supportsJmx
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public boolean supportsJmx() {
boolean pre062 = Iterables.any(getAgentConfConventionValue(), new Predicate<File>() {
@Override
public boolean apply(File file) {
return V_0_6_2_0.compareTo(extractVersion(file.getName())) > 0;
}
});
return !pre062;
}
示例7: hasOutput
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public boolean hasOutput(long id, final TestOutputEvent.Destination destination) {
return Iterables.any(
classOutputProviders.get(id),
new Predicate<DelegateProvider>() {
public boolean apply(DelegateProvider delegateProvider) {
return delegateProvider.provider.hasOutput(delegateProvider.id, destination);
}
});
}
示例8: containsLibraryWithSameName
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private static boolean containsLibraryWithSameName(Set<ProjectLibrary> libraries, final String name) {
return Iterables.any(libraries, new Predicate<ProjectLibrary>() {
@Override
public boolean apply(ProjectLibrary library) {
return Objects.equal(library.getName(), name);
}
});
}
示例9: pathMatches
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public boolean pathMatches(final Path path) {
return Iterables.any(basePaths, basePath -> {
if (basePath == null) {
return false;
}
Path normalizedPath = path.normalize();
normalizedPath = basePath.getParent().resolve(normalizedPath);
return basePath.equals(normalizedPath);
});
}
示例10: pathMatches
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public boolean pathMatches(final Path path) {
return Iterables.any(basePaths, basePath -> {
if (basePath == null) {
return false;
}
Path normalizedPath = path.normalize();
normalizedPath = basePath.getParent().resolve(normalizedPath);
// only allow files in the same directory
if (!basePath.getParent().equals(normalizedPath.getParent())) {
return false;
}
final String filename = normalizedPath.getFileName().toString();
final String baseFilename = basePath.getFileName().toString();
// same files are a match
if (filename.equals(baseFilename)) {
return true;
}
// do the files have a common beginning? if not, they aren't related.
if (!filename.startsWith(baseFilename)) {
return false;
}
// check for number suffix
final String onlySuffix = filename.substring(baseFilename.length());
return onlySuffix.matches("^\\.\\d+$");
});
}
示例11: tableHasUnsupportedColumns
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
* Indicates if the table has a column with a column type which we can't
* output to a spreadsheet.
*
* @param table The table metadata.
* @return
*/
boolean tableHasUnsupportedColumns(Table table) {
return Iterables.any(table.columns(), new Predicate<Column>() {
@Override
public boolean apply(Column column) {
return !supportedDataTypes.contains(column.getType());
}
});
}
示例12: hasInteractiveModules
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public boolean hasInteractiveModules() {
return Iterables.any(items, new Predicate<ItemController>() {
@Override
public boolean apply(ItemController item) {
return item.hasInteractiveModules();
}
});
}
示例13: transform
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass)
{
if (basicClass == null) return null;
ClassNode classNode = new ClassNode();
new ClassReader(basicClass).accept(classNode, 0);
boolean isSubscriber = false;
for (MethodNode methodNode : classNode.methods)
{
List<AnnotationNode> anns = methodNode.visibleAnnotations;
if (anns != null && Iterables.any(anns, SubscribeEventPredicate.INSTANCE))
{
if (Modifier.isPrivate(methodNode.access))
{
String msg = "Cannot apply @SubscribeEvent to private method %s/%s%s";
throw new RuntimeException(String.format(msg, classNode.name, methodNode.name, methodNode.desc));
}
methodNode.access = toPublic(methodNode.access);
isSubscriber = true;
}
}
if (isSubscriber)
{
classNode.access = toPublic(classNode.access);
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
classNode.accept(writer);
return writer.toByteArray();
}
return basicClass;
}
示例14: hasAnyNaN
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
boolean hasAnyNaN() {
return Iterables.any(values, Predicates.equalTo(NaN));
}
示例15: hasAnyNegativeInfinity
import com.google.common.collect.Iterables; //导入方法依赖的package包/类
boolean hasAnyNegativeInfinity() {
return Iterables.any(values, Predicates.equalTo(NEGATIVE_INFINITY));
}