java类com.google.common.collect.FluentIterable的实例源码

JobUI.java 文件源码 项目:dremio-oss 阅读 21 收藏 0 点赞 0 评论 0
public JobUI(Job job) {
  this.jobId = job.getJobId();
  this.attempts = FluentIterable.from(job.getAttempts())
    .transform(new Function<JobAttempt, JobAttemptUI>() {
      @Override
      public JobAttemptUI apply(JobAttempt input) {
        return toUI(input);
      }
    }).toList();
  this.data = new JobDataWrapper(job.getData());
}
ProtoRegistryTest.java 文件源码 项目:rejoiner 阅读 24 收藏 0 点赞 0 评论 0
@Test
public void protoRegistryShouldIncludeAllProtoTypesFromFile() {
  Set<GraphQLType> graphQLTypes =
      ProtoRegistry.newBuilder().add(TestProto.getDescriptor()).build().listTypes();
  assertThat(FluentIterable.from(graphQLTypes).transform(GET_NAME))
      .containsExactly(
          "javatests_com_google_api_graphql_rejoiner_proto_Proto1",
          "javatests_com_google_api_graphql_rejoiner_proto_Proto2",
          "javatests_com_google_api_graphql_rejoiner_proto_Proto1_InnerProto",
          "javatests_com_google_api_graphql_rejoiner_proto_Proto2_TestEnum",
          "Input_javatests_com_google_api_graphql_rejoiner_proto_Proto1",
          "Input_javatests_com_google_api_graphql_rejoiner_proto_Proto2",
          "Input_javatests_com_google_api_graphql_rejoiner_proto_Proto1_InnerProto");
}
AnswerKey.java 文件源码 项目:tac-kbp-eal 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Get all responses, assessed and unassessed
 */
public ImmutableSet<Response> allResponses() {
  return ImmutableSet.copyOf(
      concat(FluentIterable.from(annotatedResponses())
              .transform(AssessedResponseFunctions.response()),
          unannotatedResponses()));
}
DefaultRoleInitializationService.java 文件源码 项目:apollo-custom 阅读 29 收藏 0 点赞 0 评论 0
private void createAppMasterRole(String appId, String operator) {
  Set<Permission> appPermissions =
      FluentIterable.from(Lists.newArrayList(
          PermissionType.CREATE_CLUSTER, PermissionType.CREATE_NAMESPACE, PermissionType.ASSIGN_ROLE))
          .transform(permissionType -> createPermission(appId, permissionType, operator)).toSet();
  Set<Permission> createdAppPermissions = rolePermissionService.createPermissions(appPermissions);
  Set<Long>
      appPermissionIds =
      FluentIterable.from(createdAppPermissions).transform(permission -> permission.getId()).toSet();

  //create app master role
  Role appMasterRole = createRole(RoleUtils.buildAppMasterRoleName(appId), operator);

  rolePermissionService.createRoleWithPermissions(appMasterRole, appPermissionIds);
}
EREAligner.java 文件源码 项目:tac-kbp-eal 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Gets an identifier corresponding to the ERE object the response aligns to, if any.
 */
public Optional<ScoringCorefID> argumentForResponse(final Response response) {
  if (response.role().equalTo(TIME)) {
    // time is a special case; its CAS is always its TIMEX form
    return Optional.of(new ScoringCorefID.Builder().scoringEntityType(ScoringEntityType.Time)
        .withinTypeID(response.canonicalArgument().string()).build());
  }

  final MappedEventTypeRole systemTypeRole = typeRoleForResponse(response);
  final ImmutableSet<CandidateAlignmentTarget> searchOrder =
      FluentIterable.from(candidateEREObjects)
          // alignment candidates which match the response in event type
          // and argument role will always be searched before other candidates
          // in order to be as generous as possible to systems.
          // Note ImmutableSets iterate deterministically in the order of insertion
          .filter(compose(containsElement(systemTypeRole), typeRolesSeen()))
          .append(candidateEREObjects)
          .toSet();

  // for each alignment rule in order, try to find an ERE object which aligns
  for (final ResponseToEREAlignmentRule responseChecker : responseMatchingStrategy) {
    for (final CandidateAlignmentTarget alignmentCandidate : searchOrder) {
      if (responseChecker.aligns(response, alignmentCandidate)) {
        return Optional.of(alignmentCandidate.id());
      }
    }
  }

  return Optional.absent();
}
Locations.java 文件源码 项目:ArchUnit 阅读 35 收藏 0 点赞 0 评论 0
private static Set<Location> jarLocationsOf(URLClassLoader loader) {
    return FluentIterable.from(Locations.of(ImmutableSet.copyOf(loader.getURLs())))
            .filter(new Predicate<Location>() {
                @Override
                public boolean apply(Location input) {
                    return input.isJar();
                }
            }).toSet();
}
PlanningStage.java 文件源码 项目:dremio-oss 阅读 29 收藏 0 点赞 0 评论 0
public static List<ViewFieldType> removeUpdateColumn(final List<ViewFieldType> fields) {
  return FluentIterable.from(fields).filter(new Predicate<ViewFieldType>() {
    @Override
    public boolean apply(@Nullable ViewFieldType input) {
      return !IncrementalUpdateUtils.UPDATE_COLUMN.equals(input.getName());
    }
  }).toList();
}
ApiIntentMessageMapper.java 文件源码 项目:dremio-oss 阅读 22 收藏 0 点赞 0 评论 0
private LayoutContainerDescriptor toIntentMessage(final LayoutContainerApiDescriptor descriptor) {
  return new LayoutContainerDescriptor()
      .setEnabled(descriptor.getEnabled())
      .setType(descriptor.getType())
      .setLayoutList(FluentIterable
          .from(descriptor.getLayoutList())
          .transform(new Function<LayoutApiDescriptor, LayoutDescriptor>() {
            @Nullable
            @Override
            public LayoutDescriptor apply(@Nullable final LayoutApiDescriptor input) {
              final LayoutDetailsApiDescriptor details = input.getDetails();
              return new LayoutDescriptor()
                  .setId(toLayoutId(input.getId()))
                  .setName(input.getName())
                  .setDetails(new LayoutDetailsDescriptor()
                      .setDisplayFieldList(toIntentFields(details.getDisplayFieldList()))
                      .setMeasureFieldList(toIntentFields(details.getMeasureFieldList()))
                      .setDimensionFieldList(toIntentDimensionFields(details.getDimensionFieldList()))
                      .setPartitionFieldList(toIntentFields(details.getPartitionFieldList()))
                      .setSortFieldList(toIntentFields(details.getSortFieldList()))
                      .setDistributionFieldList(toIntentFields(details.getDistributionFieldList()))
                      .setPartitionDistributionStrategy(details.getPartitionDistributionStrategy())
                  );
            }
          })
          .toList()
      );
}
EventArgumentEquivalenceSpecFormats.java 文件源码 项目:tac-kbp-eal 阅读 28 收藏 0 点赞 0 评论 0
@Override
public ImmutableSet<Symbol> docIDs() throws IOException {
  return FluentIterable.from(Arrays.asList(directory.listFiles()))
      .transform(FileUtils.ToName)
      .transform(Symbol.FromString)
      .toSet();
}
AccelerationMapper.java 文件源码 项目:dremio-oss 阅读 25 收藏 0 点赞 0 评论 0
public List<LayoutField> toLayoutFields(final List<LayoutFieldDescriptor> fields) {
  return FluentIterable.from(AccelerationUtils.selfOrEmpty(fields))
      .transform(new Function<LayoutFieldDescriptor, LayoutField>() {
        @Nullable
        @Override
        public LayoutField apply(@Nullable final LayoutFieldDescriptor field) {
          return toLayoutField(field);
        }
      })
      .toList();
}


问题


面经


文章

微信
公众号

扫码关注公众号