aboutsummaryrefslogtreecommitdiff
path: root/test/containers.cc
blob: 9667564e7e7d6e94169de45a660f4db26680b651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "../lout/object.hh"
#include "../lout/container.hh"

using namespace lout::object;
using namespace lout::container::typed;

void testHashTable ()
{
   HashTable<String, Integer> h(true, true);

   h.put (new String ("one"), new Integer (1));
   h.put (new String ("two"), new Integer (2));
   h.put (new String ("three"), new Integer (3));
   
   Iterator<String> it = h.iterator ();
   while (it.hasNext ()) {
      String *k = it.getNext ();
      Integer *v = h.get (k);
      printf ("%s -> %d\n", k->chars(), v->getValue());
   }
}

int main (int argc, char *argv[])
{
   testHashTable ();

   return 0;
}