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

com.activitystream.helpers.MapCreator Maven / Gradle / Ivy

Go to download

For a description please see https://github.com/activitystream/as-sdk-java

There is a newer version: 0.5.8
Show newest version
package com.activitystream.helpers;

import com.activitystream.underware.Factories;

import java.util.Map;

public class MapCreator {
    Map backend = Factories.getMap();

    private void add(KVPair pair) {
        backend.put(pair.key, pair.value);
    }

    public KVPair key(K key) {
        return new KVPair(key, this);
    }

    public Map map() {return backend;}

    public class KVPair {
        private K key;
        private MapCreator owner;
        private V value;

        public KVPair(K key, MapCreator owner) {
            this.key = key;
            this.owner = owner;
        }

        public MapCreator value(V value) {
            this.value = value;
            owner.add(this);
            return owner;
        }
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy