本文整理汇总了Java中com.google.common.collect.Iterators.transform方法的典型用法代码示例。如果您正苦于以下问题:Java Iterators.transform方法的具体用法?Java Iterators.transform怎么用?Java Iterators.transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Iterators
的用法示例。
在下文中一共展示了Iterators.transform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterator
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public Iterator<Binding<?>> iterator() {
return Iterators.transform(lookups.entrySet().iterator(), new Function<Entry<Class<?>, Resolver>, Binding<?>>(){
@Override
public Binding apply(Entry<Class<?>, Resolver> input) {
switch(input.getValue().getType()){
case INSTANCE:
return new InstanceBinding(input.getKey(), ((InjectableReference)input.getValue()).clazz);
case SINGLETON:
return new SingletonBinding(input.getKey(), input.getValue().get(null));
default:
throw new IllegalStateException();
}
}});
}
示例2: getInterfaces
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Nonnull @Override public Set<String> getInterfaces() {
return new AbstractSet<String>() {
@Nonnull @Override public Iterator<String> iterator() {
return Iterators.transform(Iterators.forArray(cls.getInterfaces()), new Function<Class, String>() {
@Nullable @Override public String apply(@Nullable Class input) {
if (input == null) {
return null;
}
return ReflectionUtils.javaToDexName(input.getName());
}
});
}
@Override public int size() {
return cls.getInterfaces().length;
}
};
}
示例3: getFields
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Nonnull @Override public Set<? extends Field> getFields() {
return new AbstractSet<Field>() {
@Nonnull @Override public Iterator<Field> iterator() {
return Iterators.transform(Iterators.forArray(cls.getDeclaredFields()),
new Function<java.lang.reflect.Field, Field>() {
@Nullable @Override public Field apply(@Nullable java.lang.reflect.Field input) {
return new ReflectionField(input);
}
});
}
@Override public int size() {
return cls.getDeclaredFields().length;
}
};
}
示例4: iterator
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Override
public Iterator<T> iterator() {
viewState.assertCanReadChildren();
return Iterators.transform(keySet().iterator(), new Function<String, T>() {
@Override
public T apply(@Nullable String name) {
return get(name);
}
});
}
示例5: getCompletions
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Override
public Iterator<String> getCompletions(ArgumentContext context) {
String textSoFar = context.text;
List<String> sections = COMMA_SPLITTER.splitToList(textSoFar);
String lastSection = Iterables.getLast(sections);
String prependText = String.join(",", sections.subList(0, sections.size() - 1));
Iterator<String> integer = Iterators.transform(delegate.getCompletions(context.withText(lastSection)), prependText::concat);
if (textSoFar.isEmpty() || textSoFar.endsWith(",") || textSoFar.codePoints().filter(cp -> cp == ',').count() >= (dimensions - 1)) {
return integer;
}
return Iterators.concat(integer, Iterators.transform(COMMA.iterator(), textSoFar::concat));
}
示例6: newStreamInput
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Override
public InputStream newStreamInput(String name) {
Iterator<ReadResponse> replies = bsBlockingStub
.get()
.read(ReadRequest.newBuilder().setResourceName(name).build());
return new ByteStringIteratorInputStream(Iterators.transform(replies, (reply) -> reply.getData()));
}
示例7: transformEntries
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
private static <K, V> Iterator<Entry<K, V>> transformEntries(Iterator<Entry<K, V>> entries) {
return Iterators.transform(
entries,
new Function<Entry<K, V>, Entry<K, V>>() {
@Override
public Entry<K, V> apply(Entry<K, V> entry) {
return new UnmodifiableEntry<K, V>(entry);
}
});
}
示例8: newCastingIterable
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
public static <T> Iterable<T> newCastingIterable(final Iterator<?> input, final Class<T> type)
{
return new Iterable<T>()
{
@Override
public Iterator<T> iterator()
{
return Iterators.transform(input, new TypeCastFunction<T>(type));
}
};
}
示例9: getNonDefaultOptions
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
/**
* @return all system options that have been set to a non-default value
*/
public OptionList getNonDefaultOptions() {
Iterator<OptionValue> persistedOptions = Iterators.transform(this.options.getAll(), EXTRACT_OPTIONS);
OptionList nonDefaultOptions = new OptionList();
Iterators.addAll(nonDefaultOptions, persistedOptions);
return nonDefaultOptions;
}
示例10: builtInAnalyzers
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
private Iterator<RoutineInfo> builtInAnalyzers() {
return Iterators.transform(
ftResolver.getBuiltInAnalyzers().iterator(),
new Function<String, RoutineInfo>() {
@Nullable
@Override
public RoutineInfo apply(@Nullable String input) {
return new RoutineInfo(input,
RoutineType.ANALYZER.getName());
}
});
}
示例11: builtInCharFilters
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
private Iterator<RoutineInfo> builtInCharFilters() {
return Iterators.transform(
ftResolver.getBuiltInCharFilters().iterator(),
new Function<String, RoutineInfo>() {
@Nullable
@Override
public RoutineInfo apply(@Nullable String input) {
return new RoutineInfo(input,
RoutineType.CHAR_FILTER.getName());
}
});
}
示例12: builtInTokenizers
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
private Iterator<RoutineInfo> builtInTokenizers() {
return Iterators.transform(
ftResolver.getBuiltInTokenizers().iterator(),
new Function<String, RoutineInfo>() {
@Nullable
@Override
public RoutineInfo apply(@Nullable String input) {
return new RoutineInfo(input,
RoutineType.TOKENIZER.getName());
}
});
}
示例13: iterator
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Override
public Iterator<IndexShard> iterator() {
return Iterators.transform(shards.values().iterator(), new Function<IndexShardInjectorPair, IndexShard>() {
@Override
public IndexShard apply(IndexShardInjectorPair input) {
return input.getIndexShard();
}
});
}
示例14: iterator
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
public Iterator<Mapper> iterator() {
return Iterators.transform(mappers.values().iterator(), new Function<ObjectCursor<FieldMapper>, Mapper>() {
@Override
public Mapper apply(@Nullable ObjectCursor<FieldMapper> cursor) {
return cursor.value;
}
});
}
示例15: iterator
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Override
public Iterator<String> iterator() {
return Iterators
.transform(scope.getAllElements().iterator(), new EObjectDescriptionToNameWithPositionMapper(
getCurrentURI(), withLineNumber));
}