本文整理匯總了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);
}
示例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);
}
示例3: iterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public Iterator<Slice> iterator()
{
return Iterators.singletonIterator(Slice.ALL);
}
示例4: iterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalOperator> iterator() {
return Iterators.singletonIterator(getInput());
}
示例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();
}
示例6: iterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalOperator> iterator() {
return Iterators.singletonIterator(getInput());
}
示例7: iterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalOperator> iterator() {
return Iterators.singletonIterator(input);
}
示例8: iterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalOperator> iterator() {
return Iterators.singletonIterator(stream.get(stream.size() - 1));
}
示例9: childrenIterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<Tree> childrenIterator() {
return Iterators.singletonIterator(operator);
}
示例10: iterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<LogicalExpression> iterator() {
return Iterators.singletonIterator(child);
}
示例11: childrenIterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<Tree> childrenIterator() {
return Iterators.singletonIterator(selector);
}
示例12: childrenIterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<Tree> childrenIterator() {
return Iterators.singletonIterator(parentSelector);
}
示例13: iterator
import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public Iterator<PhysicalOperator> iterator() {
return Iterators.singletonIterator(child);
}