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

com.rumwei.util.MapUtilGW Maven / Gradle / Ivy

There is a newer version: 1.0.8
Show newest version
package com.rumwei.util;

import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

@Slf4j
public class MapUtilGW {

    /*
    * 构建一个Map对象,key为key+i,value为value+i,其中1<=i<=num
    * @Info: 底层为HashMap
    * */
    public static Map generateMapString(String key, String value, int num){
        Map result = new HashMap();
        for (int i=1; i<=num; i++){
            result.put(key+i,value+i);
        }
        return result;
    }

    /*
     * 构建一个Map对象,key为i,value为i,其中1<=i<=num
     * @Info: 底层为HashMap
     * */
    public static Map generateMapInteger(int num){
        Map result = new HashMap();
        for (int i=1; i<=num; i++){
            result.put(i,i);
        }
        return result;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy