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


Java Iterators.transform方法代码示例

本文整理汇总了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();
      }

    }});
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:18,代码来源:BinderImpl.java

示例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;
        }
    };
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:19,代码来源:ReflectionClassDef.java

示例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;
        }
    };
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:17,代码来源:ReflectionClassDef.java

示例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);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:NodeBackedModelMap.java

示例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));
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:13,代码来源:VecArg.java

示例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()));
}
 
开发者ID:bazelbuild,项目名称:bazel-buildfarm,代码行数:8,代码来源:StubInstance.java

示例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);
        }
      });
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:11,代码来源:MutableTypeToInstanceMap.java

示例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));
        }
    };
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:GenericIterableFactory.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:SystemOptionManager.java

示例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());
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:RoutineInfos.java

示例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());
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:RoutineInfos.java

示例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());
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:RoutineInfos.java

示例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();
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:IndexService.java

示例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;
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:FieldMapper.java

示例15: iterator

import com.google.common.collect.Iterators; //导入方法依赖的package包/类
@Override
public Iterator<String> iterator() {
	return Iterators
			.transform(scope.getAllElements().iterator(), new EObjectDescriptionToNameWithPositionMapper(
					getCurrentURI(), withLineNumber));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:7,代码来源:ScopeAwareIterable.java


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