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

org.geolatte.geom.generator.PropertyMapGenerator Maven / Gradle / Ivy

Go to download

This geoLatte-geom library offers a geometry model that conforms to the OGC Simple Features for SQL specification.

The newest version!
package org.geolatte.geom.generator;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.IntStream;

/**
 * Created by Karel Maesen, Geovise BVBA on 2019-08-16.
 */
public class PropertyMapGenerator implements Generator> {

    private final int size;
    private final Choice> valueGenerator;
    private final Generator keyGenerator;

    public PropertyMapGenerator(int size, Generator keyGenerator, Choice> valueGeneratorChoice) {
        this.size = size;
        this.keyGenerator = keyGenerator;
        valueGenerator = valueGeneratorChoice;
    }

    @Override
    public Map generate() {
        Map map = new HashMap<>();
        IntStream.range(0, size).forEach(i -> {
            map.put(keyGenerator.generate(), valueGenerator.generate().generate());
        });
        return map;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy