org.sfm.utils.ListHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simpleFlatMapper Show documentation
Show all versions of simpleFlatMapper Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.sfm.utils;
import java.util.ArrayList;
import java.util.List;
/**
* Implementation of {@link org.sfm.utils.RowHandler} that collect all the value into a list.
* Equivalent to a {@link java.util.stream.Collectors#toList()}.
* @param the type of the callback argument
*/
public final class ListHandler implements RowHandler {
private final List list = new ArrayList();
@Override
public void handle(final T t) {
list.add(t);
}
/**
*
* @return the collected objects
*/
public List getList() {
return list;
}
}