All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.inamik.text.tables.cell.BottomPad Maven / Gradle / Ivy

The newest version!
/*
 * iNamik Text Tables for Java
 * 
 * Copyright (C) 2016 David Farrell ([email protected])
 *
 * Licensed under The MIT License (MIT), see LICENSE.txt
 */
package com.inamik.text.tables.cell;

import com.inamik.text.tables.cell.base.FunctionWithHeight;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public final class BottomPad extends FunctionWithHeight
{
    public static final BottomPad INSTANCE = new BottomPad();

    @Override
    public Collection apply(Integer height, Collection cell) {
        // Any padding needed?
        //
        if (cell.size() >= height) {
            return cell;
        }
        List newCell = new ArrayList(height);
        newCell.addAll(cell);
        while (newCell.size() < height) {
            newCell.add("");
        }
        return newCell;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy