org.telegram.telegrambots.abilitybots.api.db.BackupMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of telegrambots-abilities Show documentation
Show all versions of telegrambots-abilities Show documentation
AbilityBot Extension and Abstraction
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