Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * (c) Copyright 2017 Hewlett-Packard Development Company, L.P.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0 which accompany this distribution.
 *
 * The Apache License is available at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *******************************************************************************/

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

public class Main {
    private static Map<String, Boolean> parseFeatures(String features) {
        Map<String, Boolean> map = new HashMap<>();
        String[] featuresList = features.split("\\n");
        int len$ = featuresList.length;

        for (int i$ = 0; i$ < len$; ++i$) {
            String element = featuresList[i$];
            String[] keyValue = element.split("\\s");
            if (keyValue.length != 2) {
                throw new IllegalArgumentException("Wrong format for \'features\' input field!");
            }

            map.put(keyValue[0], Boolean.valueOf(keyValue[1]));
        }

        return map;
    }
}