Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Map;
import java.util.Map.Entry;

public class Main {
    public static String serializeAttributes(Map<String, String> attributes) {
        String serialization = "";
        for (Entry<String, String> entry : attributes.entrySet()) {
            serialization = concatKeyValue(serialization, entry.getKey(), entry.getValue());
        }
        return serialization;
    }

    public static String concatKeyValue(String baseString, String key, String value) {
        return baseString + " " + serializeKeyValue(key, value);
    }

    private static String serializeKeyValue(String key, String value) {
        return key + "=\"" + value + "\"";
    }
}