linux: Add constants from program_invocation_name(3)
[vala-gnome.git] / gee / map.vala
blob2c96a3d0452d836d95c055a8af14a5e62ca82c12
1 /* map.vala
3 * Copyright (C) 2007 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Jürg Billeter <j@bitron.ch>
23 /**
24 * A map is a generic collection of key/value pairs.
26 public abstract class Vala.Map<K,V> {
27 /**
28 * The number of items in this map.
30 public abstract int size { get; }
32 /**
33 * Returns the keys of this map as a read-only set.
35 * @return the keys of the map
37 public abstract Set<K> get_keys ();
39 /**
40 * Returns the values of this map as a read-only collection.
42 * @return the values of the map
44 public abstract Collection<V> get_values ();
46 /**
47 * Determines whether this map contains the specified key.
49 * @param key the key to locate in the map
51 * @return true if key is found, false otherwise
53 public abstract bool contains (K key);
55 /**
56 * Returns the value of the specified key in this map.
58 * @param key the key whose value is to be retrieved
60 * @return the value associated with the key, or null if the key
61 * couldn't be found
63 public abstract V? get (K key);
65 /**
66 * Inserts a new key and value into this map.
68 * @param key the key to insert
69 * @param value the value to associate with the key
71 public abstract void set (K key, V value);
73 /**
74 * Removes the specified key from this map.
76 * @param key the key to remove from the map
78 * @return true if the map has been changed, false otherwise
80 public abstract bool remove (K key);
82 /**
83 * Removes all items from this collection. Must not be called on
84 * read-only collections.
86 public abstract void clear ();
88 /**
89 * Returns a Iterator that can be used for simple iteration over a
90 * map.
92 * @return a Iterator that can be used for simple iteration over a
93 * map
95 public abstract MapIterator<K,V> map_iterator ();