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

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

package com.activitystream.helpers;

import com.activitystream.underware.Factories;

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

public class MapCreator {
    Map backend = Factories.getMap();
    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;
        }
    }
    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;}
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy