org.sfm.utils.ListHandler Maven / Gradle / Ivy
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;
}
}