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

org.entur.netex.index.impl.NetexEntityMapByIdImpl Maven / Gradle / Ivy

There is a newer version: 3.1.29
Show newest version
package org.entur.netex.index.impl;

import org.entur.netex.index.api.NetexEntityIndex;
import org.rutebanken.netex.model.EntityStructure;

import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class NetexEntityMapByIdImpl implements NetexEntityIndex {
    private final Map map = new ConcurrentHashMap<>();

    @Override
    public V get(String id) {
        return map.get(id);
    }

    @Override
    public Collection getAll() {
        return map.values();
    }

    @Override
    public void put(String id, V entity) {
        map.put(id, entity);
    }

    @Override
    public void putAll(Collection entities) {
        entities.forEach(this::add);
    }

    @Override
    public void remove(String id) {
        map.remove(id);
    }

    public void add(V entity) {
        map.put(entity.getId(), entity);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy