當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。