當前位置: 首頁>>代碼示例>>Java>>正文


Java Iterators.singletonIterator方法代碼示例

本文整理匯總了Java中com.google.common.collect.Iterators.singletonIterator方法的典型用法代碼示例。如果您正苦於以下問題:Java Iterators.singletonIterator方法的具體用法?Java Iterators.singletonIterator怎麽用?Java Iterators.singletonIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.Iterators的用法示例。


在下文中一共展示了Iterators.singletonIterator方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: iterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public UnmodifiableIterator<E> iterator() {
  E connectingEdge = getConnectingEdge();
  return (connectingEdge == null)
      ? ImmutableSet.<E>of().iterator()
      : Iterators.singletonIterator(connectingEdge);
}
 
開發者ID:paul-hammant,項目名稱:googles-monorepo-demo,代碼行數:8,代碼來源:EdgesConnecting.java

示例2: readSingleChunk

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Test
public void readSingleChunk() throws IOException {
  ByteString hello = ByteString.copyFromUtf8("Hello, World");
  InputStream in = new ByteStringIteratorInputStream(
      Iterators.<ByteString>singletonIterator(hello));
  byte[] data = new byte[hello.size()];

  assertThat(in.read(data)).isEqualTo(hello.size());
  assertThat(ByteString.copyFrom(data)).isEqualTo(hello);
  assertThat(in.read()).isEqualTo(-1);
}
 
開發者ID:bazelbuild,項目名稱:bazel-buildfarm,代碼行數:12,代碼來源:ByteStringIteratorInputStreamTest.java

示例3: iterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public Iterator<Slice> iterator()
{
    return Iterators.singletonIterator(Slice.ALL);
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:5,代碼來源:Slices.java

示例4: iterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalOperator> iterator() {
  return Iterators.singletonIterator(getInput());
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:5,代碼來源:Limit.java

示例5: TreeIterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public TreeIterator(Instance instance, Digest rootDigest, String pageToken) {
  this.instance = instance;
  parentPath = new ArrayDeque<Digest>();
  pointers = new Stack<Iterator<Digest>>();

  Iterator<Digest> iter = Iterators.singletonIterator(rootDigest);

  Directory directory = expectDirectory(instance.getBlob(rootDigest));

  if (!pageToken.isEmpty()) {
    TreeIteratorToken token = parseToken(BaseEncoding.base64().decode(pageToken));

    for (Digest digest : token.getDirectoriesList()) {
      boolean found = false;
      while (!found && iter.hasNext()) {
        if (iter.next().equals(digest)) {
          found = true;
        }
      }
      if (!found) {
        throw new IllegalArgumentException();
      }
      parentPath.addLast(digest);
      pointers.push(iter);
      directory = expectDirectory(instance.getBlob(digest));
      if (directory == null) {
        // some directory data has disappeared, current iter
        // is correct and will be next directory fetched
        break;
      }
      iter = Iterators.transform(
          directory.getDirectoriesList().iterator(),
          directoryNode -> {
            return directoryNode.getDigest();
          });
    }
  }
  pointers.push(iter);
  path = parentPath.clone();
  advanceIterator();
}
 
開發者ID:bazelbuild,項目名稱:bazel-buildfarm,代碼行數:42,代碼來源:TreeIterator.java

示例6: iterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalOperator> iterator() {
    return Iterators.singletonIterator(getInput());
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:5,代碼來源:Order.java

示例7: iterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalOperator> iterator() {
  return Iterators.singletonIterator(input);
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:5,代碼來源:SingleInputOperator.java

示例8: iterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalOperator> iterator() {
    return Iterators.singletonIterator(stream.get(stream.size() - 1));
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:5,代碼來源:Sequence.java

示例9: childrenIterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<Tree> childrenIterator() {
  return Iterators.singletonIterator(operator);
}
 
開發者ID:racodond,項目名稱:sonar-css-plugin,代碼行數:5,代碼來源:ScssOperatorTreeImpl.java

示例10: iterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalExpression> iterator() {
  return Iterators.singletonIterator(child);
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:5,代碼來源:ValueVectorWriteExpression.java

示例11: childrenIterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<Tree> childrenIterator() {
  return Iterators.singletonIterator(selector);
}
 
開發者ID:racodond,項目名稱:sonar-css-plugin,代碼行數:5,代碼來源:KeyframesSelectorTreeImpl.java

示例12: childrenIterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<Tree> childrenIterator() {
  return Iterators.singletonIterator(parentSelector);
}
 
開發者ID:racodond,項目名稱:sonar-css-plugin,代碼行數:5,代碼來源:LessParentSelectorTreeImpl.java

示例13: iterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<PhysicalOperator> iterator() {
    return Iterators.singletonIterator(child);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:5,代碼來源:WriterCommitterPOP.java


注:本文中的com.google.common.collect.Iterators.singletonIterator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。