Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Gee
- {
- public struct PEntry<K ,V>
- {
- K Key;
- V Value;
- public PEntry(K key, V value)
- {
- Key = key;
- Value = value;
- }
- }
- public class HashMapExtensions<K,V> : HashMap<K,V>
- {
- //stub, will it build?
- public HashMapExtensions()
- {
- base();
- }
- public HashMapExtensions.from_data(PEntry<K,V>[] entries)
- {
- base();
- foreach (PEntry<K,V> entry in entries)
- {
- base.set(entry.Key, entry.Value);
- }
- }
- }
- }
- public class Program
- {
- /*
- public static Gee.HashMapExtensions<int, int> bla = new Gee.HashMapExtensions<int, int>.from_data({
- {0, 0}
- });
- */
- public static Gee.HashMapExtensions<int, string> bla = new Gee.HashMapExtensions<int, string>.from_data({
- Gee.PEntry<int, string>(1 ,"HEY"),
- Gee.PEntry<int, string>(3, "STE")
- });
- public static int main(string[] args)
- {
- stdout.printf("Value: %s\n", bla[1]);
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement