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