[OmniFaces utilities] The
iterableToList()
method converts an iterable into a list. This method makes NO guarantee to whether changes to the source iterable are reflected in the returned list or not. For instance if the given iterable already is a list, it's returned directly.Method:
Usage:
For example, OmniFaces uses this utility in its custom DataModel named, IterableDataModel. In order to override the setWrappedData() method:
import
static org.omnifaces.util.Utils.iterableToList;
...
private
Iterable<E> iterable;
private
List<E> list;
...
@Override
public void
setWrappedData(Object data) {
if (data == null) {
iterable = null;
list = null;
setRowIndex(-1);
} else {
iterable = (Iterable<E>) data;
list = iterableToList(iterable);
setRowIndex(0);
}
}
Niciun comentariu :
Trimiteți un comentariu