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


Java Iterables.filter方法代码示例

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


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

示例1: listFolders

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public static Iterable<File> listFolders(File root) { 
	return Iterables.filter(
			Files.fileTreeTraverser().children( root ), new Predicate<File>() {
					@Override
					public boolean apply(File input) {
						return input.isDirectory();
					}
			});	
}
 
开发者ID:rockitconsulting,项目名称:test.rockitizer,代码行数:10,代码来源:FileUtils.java

示例2: configure

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public void configure(String deployName, String contextPath, List<WbModuleEntry> newEntries) {
    Iterable<WbModuleEntry> toKeep = Iterables.filter(wbModuleEntries, not(instanceOf(WbDependentModule.class)));
    this.wbModuleEntries = Lists.newArrayList(Sets.newLinkedHashSet(Iterables.concat(toKeep, newEntries)));
    if (!isNullOrEmpty(deployName)) {
        this.deployName = deployName;
    }
    if (!isNullOrEmpty(contextPath)) {
        this.contextPath = contextPath;
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:WtpComponent.java

示例3: getActiveSymptoms

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
Iterable<StaminaSymptom> getActiveSymptoms() {
    return Iterables.filter(options.symptoms, new Predicate<StaminaSymptom>() {
        @Override
        public boolean apply(StaminaSymptom symptom) {
            return symptom.range.contains(stamina);
        }
    });
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:9,代码来源:PlayerStaminaState.java

示例4: toUnit

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public Unit toUnit(Unit unit) {
  for (Template template : Iterables.filter(unit.parts(), Template.class)) {
    scope.declareInvokable(template.declaration().name());
  }
  return super.toUnit(unit);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:TypeResolver.java

示例5: compilar

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public void compilar() {
  StringBuilder sb = new StringBuilder();
  Iterable<Ingrediente> _filter = Iterables.<Ingrediente>filter(IteratorExtensions.<EObject>toIterable(this.resource.getAllContents()), Ingrediente.class);
  for (final Ingrediente i : _filter) {
    sb.append(this.compilarTexto(i));
  }
  this.fsa.generateFile("ingredientes.txt", sb.toString());
  Iterable<Restaurante> _filter_1 = Iterables.<Restaurante>filter(IteratorExtensions.<EObject>toIterable(this.resource.getAllContents()), Restaurante.class);
  for (final Restaurante r : _filter_1) {
    this.fsa.generateFile("resto_informacion.txt", this.compilarTexto(r));
  }
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:13,代码来源:GeneradorTexto.java

示例6: getManifestThemeNames

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public Iterable<String> getManifestThemeNames(InputStream is) {
    return Iterables.filter(
            Iterables.transform(
                    getAttrNames(is, manifestXpathExp),
                    new Function<String, String>() {
                @Override
                public String apply(String name) {
                    return name.startsWith("@style/") ? name.substring("@style/".length()) : null;
                }
            }),
            Predicates.notNull());
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:13,代码来源:ManifestParser.java

示例7: getNonKeyFieldsFromMergeStatement

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
 * Returns the non key fields from a merge statement.
 *
 * @param statement a merge statement
 * @return the non key fields
 */
protected Iterable<AliasedField> getNonKeyFieldsFromMergeStatement(final MergeStatement statement) {
  return Iterables.filter(statement.getSelectStatement().getFields(), new Predicate<AliasedField>() {
    @Override
    public boolean apply(AliasedField input) {
      boolean keyField = false;
      for (AliasedField field : statement.getTableUniqueKey()) {
        if (input.getImpliedName().equals(field.getImpliedName())) keyField = true;
      }
      return !keyField;
    }
  });
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:19,代码来源:SqlDialect.java

示例8: copyFiltered

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
public EventArgScoringAlignment<EquivClassType> copyFiltered(
    final Predicate<EquivClassType> filter) {
  return new EventArgScoringAlignment<EquivClassType>(docID(), argumentOutput, answerKey,
      Iterables.filter(truePositiveECs, filter),
      Iterables.filter(falsePositiveECs, filter),
      Iterables.filter(falseNegativeECs, filter),
      Iterables.filter(unassessed, filter),
      Multimaps.filterKeys(ecsToAnswerKey, filter),
      Multimaps.filterKeys(ecsToSystem, filter));
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:11,代码来源:EventArgScoringAlignment.java

示例9: getPendingLogFilesToUpload

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private Set<File> getPendingLogFilesToUpload(File containerLogDir) {
  Set<File> candidates =
      new HashSet<File>(Arrays.asList(containerLogDir.listFiles()));
  for (File logFile : candidates) {
    this.allExistingFileMeta.add(getLogFileMetaData(logFile));
  }

  if (this.logAggregationContext != null && candidates.size() > 0) {
    filterFiles(
      this.appFinished ? this.logAggregationContext.getIncludePattern()
          : this.logAggregationContext.getRolledLogsIncludePattern(),
      candidates, false);

    filterFiles(
      this.appFinished ? this.logAggregationContext.getExcludePattern()
          : this.logAggregationContext.getRolledLogsExcludePattern(),
      candidates, true);

    Iterable<File> mask =
        Iterables.filter(candidates, new Predicate<File>() {
          @Override
          public boolean apply(File next) {
            return !alreadyUploadedLogFiles
              .contains(getLogFileMetaData(next));
          }
        });
    candidates = Sets.newHashSet(mask);
  }
  return candidates;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:AggregatedLogFormat.java

示例10: getDeletableFiles

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public Iterable<FileStatus> getDeletableFiles(Iterable<FileStatus> files) {
 // all members of this class are null if replication is disabled,
 // so we cannot filter the files
  if (this.getConf() == null) {
    return files;
  }

  final Set<String> wals;
  try {
    // The concurrently created new WALs may not be included in the return list,
    // but they won't be deleted because they're not in the checking set.
    wals = loadWALsFromQueues();
  } catch (KeeperException e) {
    LOG.warn("Failed to read zookeeper, skipping checking deletable files");
    return Collections.emptyList();
  }
  return Iterables.filter(files, new Predicate<FileStatus>() {
    @Override
    public boolean apply(FileStatus file) {
      String wal = file.getPath().getName();
      boolean logInReplicationQueue = wals.contains(wal);
      if (LOG.isDebugEnabled()) {
        if (logInReplicationQueue) {
          LOG.debug("Found log in ZK, keeping: " + wal);
        } else {
          LOG.debug("Didn't find this log in ZK, deleting: " + wal);
        }
      }
     return !logInReplicationQueue;
    }});
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:ReplicationLogCleaner.java

示例11: mapGerelateerdeBetrokkenheden

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private void mapGerelateerdeBetrokkenheden() {
    final Iterable<Betrokkenheid> gerelateerdeBetrokkenheden = Iterables.filter(relatie.getBetrokkenheidSet(),
            betr -> betr.getPersoon() == null || !betr.getPersoon().getId().equals(blobber.getPersoon().getId()));
    for (final Betrokkenheid gerelateerdeBetrokkenheid : gerelateerdeBetrokkenheden) {
        new GerelateerdeBetrokkenheidBlobMapper(blobber, gerelateerdeBetrokkenheid).map();
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:8,代码来源:RelatieBlobMapper.java

示例12: findByName

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private static Iterable<UIClassDescriptor> findByName(
        Iterable<UIClassDescriptor> classes, Predicate<UIClassDescriptor> predicate) {
    return Iterables.filter(classes, predicate);
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:5,代码来源:UIClassDescriptors.java

示例13: filterUpperBounds

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
private static Iterable<Type> filterUpperBounds(Iterable<Type> bounds) {
  return Iterables.filter(bounds, Predicates.not(Predicates.<Type>equalTo(Object.class)));
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:4,代码来源:Types.java

示例14: format

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
/**
 * Construct a {@code Formatter} given a Java compilation unit. Parses the code; builds a {@link
 * JavaInput} and the corresponding {@link JavaOutput}.
 *
 * @param javaInput  the input, a Java compilation unit
 * @param javaOutput the {@link JavaOutput}
 * @param options    the {@link JavaFormatterOptions}
 */
static void format(
        final JavaInput javaInput, JavaOutput javaOutput, JavaFormatterOptions options) {
    Context context = new Context();
    DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
    context.put(DiagnosticListener.class, diagnostics);
    Options.instance(context).put("allowStringFolding", "false");
    JCCompilationUnit unit;
    JavacFileManager fileManager = new JavacFileManager(context, true, UTF_8);
    try {
        fileManager.setLocation(StandardLocation.PLATFORM_CLASS_PATH, ImmutableList.<File>of());
    } catch (IOException e) {
        // impossible
        throw new IOError(e);
    }
    SimpleJavaFileObject source =
            new SimpleJavaFileObject(URI.create("source"), JavaFileObject.Kind.SOURCE) {
                @Override
                public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
                    return javaInput.getText();
                }
            };
    Log.instance(context).useSource(source);
    ParserFactory parserFactory = ParserFactory.instance(context);
    Parser parser =
            parserFactory.newParser(
                    javaInput.getText(),
        /*keepDocComments=*/ true,
        /*keepEndPos=*/ true,
        /*keepLineMap=*/ true);
    unit = parser.parseCompilationUnit();
    unit.sourcefile = source;

    javaInput.setCompilationUnit(unit);
    Iterable<Diagnostic<? extends JavaFileObject>> errorDiagnostics =
            Iterables.filter(diagnostics.getDiagnostics(), ERROR_DIAGNOSTIC);
    if (!Iterables.isEmpty(errorDiagnostics)) {
        throw FormattingError.fromJavacDiagnostics(errorDiagnostics);
    }
    OpsBuilder builder = new OpsBuilder(javaInput, javaOutput);
    // Output the compilation unit.
    new JavaInputAstVisitor(builder, options.indentationMultiplier()).scan(unit, null);
    builder.sync(javaInput.getText().length());
    builder.drain();
    Doc doc = new DocBuilder().withOps(builder.build()).build();
    doc.computeBreaks(
            javaOutput.getCommentsHelper(), options.maxLineLength(), new Doc.State(+0, 0));
    doc.write(javaOutput);
    javaOutput.flush();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:58,代码来源:Formatter.java

示例15: getAvailableDevices

import com.google.common.collect.Iterables; //导入方法依赖的package包/类
@Override
public Iterable<Device> getAvailableDevices() {
    return Iterables.filter(Iterables.transform(availableDevices, devices::get), d -> d != null);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:5,代码来源:ECDeviceStore.java


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