Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    static Map hoodieObjectFromCouchObject(Map couchObject) {

        Map result = new HashMap();

        Iterator it = couchObject.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry pair = (Map.Entry) it.next();

            String key = pair.getKey().toString();
            String value = pair.getValue().toString();

            if (key.equals("_id")) {

                result.put("id", value.split("/")[1]);
                result.put("type", value.split("/")[0]);

            } else {
                result.put(pair.getKey(), pair.getValue());
            }
        }

        return result;
    }
}