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
20 * Jürg Billeter <j@bitron.ch>
24 * A map is a generic collection of key/value pairs.
26 public interface Vala
.Map
<K
,V
> : CollectionObject
{
28 * The number of items in this map.
30 public abstract int size
{ get; }
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 ();
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 ();
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
);
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
63 public abstract V?
get (K key
);
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
);
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
);
83 * Removes all items from this collection. Must not be called on
84 * read-only collections.
86 public abstract void clear ();