Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Properties;

public class Main {
    /**
     * return a properties with the values passed as params
     * 
     * @param strKeys the keys to insert into the pr
     * @param strValues the values to insert into the pr
     * @return
     */
    public static Properties loadProperties(String[] strKeys, String[] strValues) {

        // checks the params
        if (strKeys == null || strValues == null)
            return null;

        // inits the PR
        Properties pr = new Properties();

        // cycles on keys
        for (int j = 0; j < strKeys.length; j++) {

            // insert the j-th key into the properties
            pr.setProperty(strKeys[j], strValues[j]);
        }

        // and returns it
        return pr;
    }
}