org.hyperledger.fabric.client.MappingCloseableIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fabric-gateway Show documentation
Show all versions of fabric-gateway Show documentation
Hyperledger Fabric Gateway client API for Java
/*
* Copyright 2022 IBM All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.fabric.client;
import java.util.function.Function;
final class MappingCloseableIterator implements CloseableIterator {
private final CloseableIterator iterator;
private final Function mapper;
MappingCloseableIterator(final CloseableIterator iterator, final Function mapper) {
this.iterator = iterator;
this.mapper = mapper;
}
@Override
public void close() {
iterator.close();
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public R next() {
T value = iterator.next();
return mapper.apply(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy