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

common.java.Args.ArgsHelper Maven / Gradle / Ivy

The newest version!
package common.java.Args;

import java.util.HashMap;
import java.util.Set;

public class ArgsHelper {
    public static HashMap dictionary(String[] args) {
        HashMap dictionary = new HashMap<>();
        for (int i = 0; i < args.length; i++) {
            String arg = args[i];
            if (arg.startsWith("-")) {
                if (i + 1 < args.length) {
                    dictionary.put(arg, args[i + 1]);
                }
            }
        }
        return dictionary;
    }

    public static Set keys(String[] args) {
        return dictionary(args).keySet();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy