package com.ywt.mg.domain.models;

import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;

/**
 * @author Walker
 * Created on 2019/6/27
 */
public class ExcelDataMap extends LinkedHashMap<String, List<String>> {
    public ExcelDataMap(String[] columnNames) {
        super();
        for (String columnName : columnNames) {
            this.put(columnName, new LinkedList<>());
        }
    }

    public List<String> getStringListSafely(String columnKey) {
        if (this.containsKey(columnKey)) {
            return this.get(columnKey) == null ? new LinkedList<>() : this.get(columnKey);
        } else {
            List<String> list = new LinkedList<>();
            this.put(columnKey, list);
            return list;
        }
    }
}