private Object writeGrid(SerIterator itemIterator) {
        List<Object> result = new ArrayList<>();
        result.add(itemIterator.dimensionSize(0));
        result.add(itemIterator.dimensionSize(1));
        while (itemIterator.hasNext()) {
            itemIterator.next();
            Integer outputKey = (Integer) itemIterator.key();
            Integer outputCol = (Integer) itemIterator.column();
            Object outputValue = writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);
            result.add(Arrays.asList(outputKey, outputCol, outputValue));
        }
        return result;
    }
private Object writeGrid ( SerIterator itemIterator ) { List < Object > result = new ArrayList < > ( ) ; result . add ( itemIterator . dimensionSize ( 0 ) ) ; result . add ( itemIterator . dimensionSize ( 1 ) ) ; while ( itemIterator . hasNext ( ) ) { itemIterator . next ( ) ; Integer outputKey = ( Integer ) itemIterator . key ( ) ; Integer outputCol = ( Integer ) itemIterator . column ( ) ; Object outputValue = writeObject ( itemIterator . valueType ( ) , itemIterator . value ( ) , itemIterator ) ; result . add ( Arrays . asList ( outputKey , outputCol , outputValue ) ) ; } return result ; }
write grid using sparse approach