Example usage for com.google.common.collect UnmodifiableIterator forEachRemaining

List of usage examples for com.google.common.collect UnmodifiableIterator forEachRemaining

Introduction

In this page you can find the example usage for com.google.common.collect UnmodifiableIterator forEachRemaining.

Prototype

default void forEachRemaining(Consumer<? super E> action) 

Source Link

Document

Performs the given action for each remaining element until all elements have been processed or the action throws an exception.

Usage

From source file:org.eclipse.hawkbit.security.AbstractHttpControllerAuthenticationFilter.java

private DmfTenantSecurityToken createTenantSecruityTokenVariables(final HttpServletRequest request,
        final String tenant, final String controllerId) {
    final DmfTenantSecurityToken secruityToken = new DmfTenantSecurityToken(tenant, null, controllerId, null,
            FileResource.createFileResourceBySha1(""));
    final UnmodifiableIterator<String> forEnumeration = Iterators.forEnumeration(request.getHeaderNames());
    forEnumeration.forEachRemaining(header -> secruityToken.putHeader(header, request.getHeader(header)));
    return secruityToken;
}