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

org.telegram.telegrambots.abilitybots.api.db.BackupMap Maven / Gradle / Ivy

There is a newer version: 7.10.0
Show newest version
package org.telegram.telegrambots.abilitybots.api.db;

import org.telegram.telegrambots.abilitybots.api.util.Pair;

import java.util.*;

final class BackupMap extends AbstractCollection> implements Collection> {
    private Collection> entries = new HashSet<>();

    public BackupMap(){}

    public BackupMap(Map map) {
        map.forEach((key, value) -> entries.add(Pair.of(key, value)));
    }

    public Map toMap() {
        Map map = new HashMap<>();
        entries.forEach(e -> map.put(e.a(), e.b()));
        return map;
    }

    @Override
    public Iterator> iterator() {
        return entries.iterator();
    }

    @Override
    public int size() {
        return entries.size();
    }

    @Override
    public boolean add(Pair kvPair) {
        return entries.add(kvPair);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy