Example usage for org.apache.commons.collections FactoryUtils nullFactory

List of usage examples for org.apache.commons.collections FactoryUtils nullFactory

Introduction

In this page you can find the example usage for org.apache.commons.collections FactoryUtils nullFactory.

Prototype

public static Factory nullFactory() 

Source Link

Document

Gets a Factory that will return null each time the factory is used.

Usage

From source file:org.diffkit.diff.sns.DKPoiSheet.java

@SuppressWarnings("unchecked")
private List<Type> discoverColumnTypes(List<Row> rows_) {
    if (CollectionUtils.isEmpty(rows_))
        return null;
    List<Type> columnTypes = GrowthList
            .decorate(LazyList.decorate(new ArrayList<Type>(), FactoryUtils.nullFactory()));
    int start = this.hasHeader() ? 1 : 0;
    for (int i = start; i < rows_.size(); i++) {
        Row aRow = rows_.get(i);//w w  w  . j a v  a2s  . c  o m
        int width = aRow.getLastCellNum();
        for (int j = 0; j < width; j++) {
            Cell cell = aRow.getCell(j);
            if (cell == null)
                continue;
            if (_isDebugEnabled) {
                _log.debug(String.format("cell->%s formatString->%s format->%s", cell.getColumnIndex(),
                        cell.getCellStyle().getDataFormatString(), cell.getCellStyle().getDataFormat()));
            }
            Type cellType = mapColumnType(cell);
            Type columnType = columnTypes.get(j);
            if (_isDebugEnabled)
                _log.debug("cellType->{} columnType->{}", cellType, columnType);
            if (columnType == null)
                columnTypes.set(j, cellType);
            else if (columnType != cellType)
                columnTypes.set(j, Type.MIXED);
        }
    }
    return columnTypes;
}