本文整理汇总了Java中org.apache.commons.collections4.iterators.IteratorChain类的典型用法代码示例。如果您正苦于以下问题:Java IteratorChain类的具体用法?Java IteratorChain怎么用?Java IteratorChain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IteratorChain类属于org.apache.commons.collections4.iterators包,在下文中一共展示了IteratorChain类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: _getMetrics
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
private Iterable<Metric> _getMetrics( E environment, String name, Interval interval ) {
log.debug( "Performing fetch for metric " + name + " for " + interval.toString() );
Optional<List<Metric>> metricsFromCache = environment.metricCache().getValues( name, interval );
if( metricsFromCache.isPresent() ) {
if( !metricsFromCache.get().isEmpty()
&& metricsFromCache.get().get( 0 ).timestamp() <= interval.start() ) {
log.debug( "Got all results we want from cache." );
return metricsFromCache.get();
} else {
log.debug( "Got some results from cache, but need to get the rest from the database" );
long refetchEnd = metricsFromCache.get().isEmpty() ? interval.end() : metricsFromCache.get().get( 0 ).timestamp();
return new IteratorIterable<>( new IteratorChain<>(
environment.cassandraAccessLayer().loadMetrics( name, new Interval( interval.start(), refetchEnd ) ).iterator(),
metricsFromCache.get().iterator()
) );
}
} else {
log.debug( "Got no results from cache, need to hit the database." );
return environment.cassandraAccessLayer().loadMetrics( name, interval );
}
}
开发者ID:Tetha,项目名称:bifroest,代码行数:23,代码来源:GetValueCommand.java
示例2: iterator
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
@Override
public Iterator<V> iterator() {
final IteratorChain<V> chain = new IteratorChain<V>();
for (final K k : keySet()) {
chain.addIterator(new ValuesIterator(k));
}
return chain;
}
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:MultiValueMap.java
示例3: iterator
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
/**
* Gets an iterator over all the sets in this composite.
* <p>
* This implementation uses an <code>IteratorChain</code>.
*
* @return an <code>IteratorChain</code> instance which supports
* <code>remove()</code>. Iteration occurs over contained collections in
* the order they were added, but this behavior should not be relied upon.
* @see IteratorChain
*/
public Iterator<E> iterator() {
if (all.isEmpty()) {
return EmptyIterator.<E>emptyIterator();
}
final IteratorChain<E> chain = new IteratorChain<E>();
for (final Set<E> item : all) {
chain.addIterator(item.iterator());
}
return chain;
}
开发者ID:funkemunky,项目名称:HCFCore,代码行数:21,代码来源:CompositeSet.java
示例4: iterator
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
/**
* Gets an iterator over all the collections in this composite.
* <p>
* This implementation uses an <code>IteratorChain</code>.
*
* @return an <code>IteratorChain</code> instance which supports
* <code>remove()</code>. Iteration occurs over contained collections in
* the order they were added, but this behavior should not be relied upon.
* @see IteratorChain
*/
@Override
public Iterator<E> iterator() {
if (all.isEmpty()) {
return EmptyIterator.<E>emptyIterator();
}
final IteratorChain<E> chain = new IteratorChain<E>();
for (final Collection<E> item : all) {
chain.addIterator(item.iterator());
}
return chain;
}
开发者ID:funkemunky,项目名称:HCFCore,代码行数:22,代码来源:CompositeCollection.java
示例5: getAttributeNames
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
/**
* @inheritDoc
*/
public Enumeration getAttributeNames()
{
Set<String> nonPortableAttributeNames = m_nonPortalSession.getAllAttributes().keySet();
IteratorChain ic = new IteratorChain(m_attributes.keySet().iterator(),nonPortableAttributeNames.iterator());
return new IteratorEnumeration(ic);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:10,代码来源:MySession.java
示例6: enumerate
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
/**
* Enumerates all types by prepending "pub" and "dyn" to the security
* domain. Thus, this method only works if the security domain is also
* enumerable.
*/
public Iterator<TypeView<Level>> enumerate() {
final TypeDomain<Level> self = this;
Iterator<TypeView<Level>> secLevels =
new TransformIterator<>(this.secDomain.enumerate(), new Transformer<Level, TypeView<Level>>() {
@Override
public TypeView<Level> transform(Level level) {
return self.level(level);
}
});
return new IteratorChain<>(Arrays.asList(this.pub(), this.dyn()).iterator(),
secLevels);
}
开发者ID:proglang,项目名称:jgs,代码行数:18,代码来源:TypeDomain.java
示例7: getAttributeNames
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
/**
* @inheritDoc
*/
public Enumeration getAttributeNames()
{
IteratorChain ic = new IteratorChain(m_attributes.keySet().iterator(),m_nonPortalSession.getAllAttributes().keySet().iterator());
return new IteratorEnumeration(ic);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:9,代码来源:MyLittleSession.java
示例8: iterator
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
@Override
public Iterator<E> iterator() {
return UnmodifiableIterator.decorate(new IteratorChain(Arrays.asList(used.iterator(),unused.iterator())));
}
开发者ID:jtrfp,项目名称:terminal-recall,代码行数:5,代码来源:PredicatedORCollectionActionFilter.java
示例9: chainedIterator
import org.apache.commons.collections4.iterators.IteratorChain; //导入依赖的package包/类
/**
* Gets an iterator that iterates through two {@link Iterator}s
* one after another.
*
* @param <E> the element type
* @param iterator1 the first iterator to use, not null
* @param iterator2 the second iterator to use, not null
* @return a combination iterator over the iterators
* @throws NullPointerException if either iterator is null
*/
public static <E> Iterator<E> chainedIterator(final Iterator<? extends E> iterator1,
final Iterator<? extends E> iterator2) {
// keep a version with two iterators to avoid the following warning in client code (Java 5 & 6)
// "A generic array of E is created for a varargs parameter"
return new IteratorChain<E>(iterator1, iterator2);
}
开发者ID:funkemunky,项目名称:HCFCore,代码行数:17,代码来源:IteratorUtils.java
注:本文中的org.apache.commons.collections4.iterators.IteratorChain类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论