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

DatasetVersionMutator.java 文件源码 项目:dremio-oss 阅读 24 收藏 0 点赞 0 评论 0
public Iterable<VirtualDatasetUI> getAllVersions(DatasetPath path) throws DatasetVersionNotFoundException {
  return Iterables.transform(datasetVersions.find(
      new FindByRange<>(new VersionDatasetKey(path, MIN_VERSION), false, new VersionDatasetKey(path, MAX_VERSION), false)),
    new Function<Entry<VersionDatasetKey, VirtualDatasetVersion>, VirtualDatasetUI> () {
      @Override
      public VirtualDatasetUI apply(Entry<VersionDatasetKey, VirtualDatasetVersion> input) {
        return toVirtualDatasetUI(input.getValue());
      }
    });
}
N4ClassifierDeclarationImpl.java 文件源码 项目:n4js 阅读 33 收藏 0 点赞 0 评论 0
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<N4MethodDeclaration> getOwnedMethods() {
    final Function1<N4MethodDeclaration, Boolean> _function = new Function1<N4MethodDeclaration, Boolean>() {
        public Boolean apply(final N4MethodDeclaration it) {
            return Boolean.valueOf(((!it.isConstructor()) && (!it.isCallableConstructor())));
        }
    };
    final Iterable<N4MethodDeclaration> methods = IterableExtensions.<N4MethodDeclaration>filter(Iterables.<N4MethodDeclaration>filter(this.getOwnedMembersRaw(), N4MethodDeclaration.class), _function);
    List<N4MethodDeclaration> _list = IterableExtensions.<N4MethodDeclaration>toList(methods);
    return new BasicEList<N4MethodDeclaration>(_list);
}
RexBiShuttle.java 文件源码 项目:dremio-oss 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Applies this shuttle to each expression in an iterable.
 */
public final Iterable<RexNode> apply(Iterable<? extends RexNode> iterable, final P arg) {
  return Iterables.transform(iterable, new Function<RexNode, RexNode>() {
    public RexNode apply(@Nullable RexNode t) {
      return t == null ? null : t.accept(RexBiShuttle.this, arg);
    }
  });
}
SqlParameter.java 文件源码 项目:morf 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Generates an iterable of parameters from columns.
 *
 * @param columns table columns.
 * @return parameters matching these columns.
 */
public static Iterable<SqlParameter> parametersFromColumns(Iterable<Column> columns) {
  return Iterables.transform(columns, new Function<Column, SqlParameter>() {
    @Override
    public SqlParameter apply(Column column) {
      return new SqlParameter(column);
    }
  });
}
InspectorMessenger.java 文件源码 项目:devtools-driver 阅读 30 收藏 0 点赞 0 评论 0
@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();
}
Expect.java 文件源码 项目:MCOpts 阅读 32 收藏 0 点赞 0 评论 0
/**
 * For quoted arguments with spaces that repeat just one completion
 */
public Expect words(Consumer<Expect> consumer)
{
    Expect inner = splitInner(expect -> expect.then(consumer).repeat());
    descriptionU(Iterables.getLast(inner.mapLastDescriptions((i, s) -> s)));
    return this;
}
Path.java 文件源码 项目:de.flapdoodle.solid 阅读 35 收藏 0 点赞 0 评论 0
@Auxiliary
public Pair<Path, Path> split(Predicate<Part> matcher) {
    int idx=Iterables.indexOf(parts(), p -> matcher.test(p));
    if (idx!=-1) {
        return Pair.of(Path.of(parts().subList(0, idx+1)), Path.of(parts().subList(idx+1, parts().size())));
    }
    return Pair.of(this, Path.emtpy());
}
MergedBus.java 文件源码 项目:powsybl-core 阅读 31 收藏 0 点赞 0 评论 0
@Override
public Iterable<ThreeWindingsTransformer> getThreeWindingTransformers() {
    checkValidity();
    List<Iterable<ThreeWindingsTransformer>> iterables = new ArrayList<>(buses.size());
    for (ConfiguredBus bus : buses) {
        iterables.add(bus.getThreeWindingTransformers());
    }
    return Iterables.concat(iterables);
}
DexWriter.java 文件源码 项目:andbg 阅读 27 收藏 0 点赞 0 评论 0
@Override public boolean equals(Object o) {
    if (o instanceof EncodedArrayKey) {
        EncodedArrayKey other = (EncodedArrayKey)o;
        if (elements.size() != other.elements.size()) {
            return false;
        }
        return Iterables.elementsEqual(elements, other.elements);
    }
    return false;
}
CommandBase.java 文件源码 项目:DecompiledMinecraft 阅读 31 收藏 0 点赞 0 评论 0
public static List<String> getListOfStringsMatchingLastWord(String[] p_175762_0_, Collection<?> p_175762_1_)
{
    String s = p_175762_0_[p_175762_0_.length - 1];
    List<String> list = Lists.<String>newArrayList();

    if (!p_175762_1_.isEmpty())
    {
        for (String s1 : Iterables.transform(p_175762_1_, Functions.toStringFunction()))
        {
            if (doesStringStartWith(s, s1))
            {
                list.add(s1);
            }
        }

        if (list.isEmpty())
        {
            for (Object object : p_175762_1_)
            {
                if (object instanceof ResourceLocation && doesStringStartWith(s, ((ResourceLocation)object).getResourcePath()))
                {
                    list.add(String.valueOf(object));
                }
            }
        }
    }

    return list;
}


问题


面经


文章

微信
公众号

扫码关注公众号