Example usage for org.apache.commons.collections4 IteratorUtils asEnumeration

List of usage examples for org.apache.commons.collections4 IteratorUtils asEnumeration

Introduction

In this page you can find the example usage for org.apache.commons.collections4 IteratorUtils asEnumeration.

Prototype

public static <E> Enumeration<E> asEnumeration(final Iterator<? extends E> iterator) 

Source Link

Document

Gets an enumeration that wraps an iterator.

Usage

From source file:io.wcm.testing.mock.sling.servlet.MockHttpSession.java

@Override
public Enumeration<String> getAttributeNames() {
    return IteratorUtils.asEnumeration(this.attributeMap.keySet().iterator());
}

From source file:io.wcm.testing.mock.sling.servlet.MockSlingHttpServletRequest.java

@Override
public Enumeration<String> getParameterNames() {
    return IteratorUtils.asEnumeration(this.parameterMap.keySet().iterator());
}

From source file:de.micromata.genome.gwiki.page.gspt.ServletStandalonePageContext.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//from  w w w.  j ava  2  s .co m
public Enumeration getAttributeNamesInScope(int scope) {
    switch (scope) {
    case PageContext.REQUEST_SCOPE:
        return request.getAttributeNames();
    case PageContext.SESSION_SCOPE:
        if (session != null) {
            return session.getAttributeNames();
        }
        return IteratorUtils.asEnumeration(IteratorUtils.EMPTY_ITERATOR);
    case PageContext.APPLICATION_SCOPE:
        return servletCtx.getAttributeNames();
    default:
        return IteratorUtils.asEnumeration(pageAttributes.keySet().iterator());
    }

}

From source file:org.apache.bookkeeper.client.LedgerHandle.java

void asyncReadEntriesInternal(long firstEntry, long lastEntry, ReadCallback cb, Object ctx,
        boolean isRecoveryRead) {
    if (!clientCtx.isClientClosed()) {
        readEntriesInternalAsync(firstEntry, lastEntry, isRecoveryRead)
                .whenCompleteAsync(new FutureEventListener<LedgerEntries>() {
                    @Override//  www .  j a va 2 s  . c  o m
                    public void onSuccess(LedgerEntries entries) {
                        cb.readComplete(Code.OK, LedgerHandle.this,
                                IteratorUtils.asEnumeration(Iterators.transform(entries.iterator(), le -> {
                                    LedgerEntry entry = new LedgerEntry((LedgerEntryImpl) le);
                                    le.close();
                                    return entry;
                                })), ctx);
                    }

                    @Override
                    public void onFailure(Throwable cause) {
                        if (cause instanceof BKException) {
                            BKException bke = (BKException) cause;
                            cb.readComplete(bke.getCode(), LedgerHandle.this, null, ctx);
                        } else {
                            cb.readComplete(Code.UnexpectedConditionException, LedgerHandle.this, null, ctx);
                        }
                    }
                }, clientCtx.getMainWorkerPool().chooseThread(ledgerId));
    } else {
        cb.readComplete(Code.ClientClosedException, LedgerHandle.this, null, ctx);
    }
}

From source file:org.codice.ddf.configuration.DictionaryMap.java

@Override
public Enumeration<K> keys() {
    return IteratorUtils.asEnumeration(map.keySet().iterator());
}

From source file:org.codice.ddf.configuration.DictionaryMap.java

@Override
public Enumeration<V> elements() {
    return IteratorUtils.asEnumeration(map.values().iterator());
}