imported from svn
[metux-java.git] / util / Stringtable.java
blobedff12913356be6fe957aac9056990c01faa1e50
2 package org.de.metux.util;
4 import java.util.*;
6 // FIXME: should be obsoleted by class Properties
8 public class Stringtable
10 private Hashtable h;
12 public Stringtable(Hashtable ht)
14 h = ht;
17 public Stringtable()
19 h = new Hashtable();
22 public void remove(String key)
24 if (key==null)
25 return;
26 h.remove(key);
29 public String get(String key)
31 if ((key==null) || (key.equals("")))
32 return "";
34 return (String)h.get(key);
37 public void set(String key, String value)
39 if ((key==null)||(key.length()==0))
40 return;
42 if ((value==null)||(value.length()==0))
43 h.remove(key);
44 else
45 h.put(key,value);
48 public final void add(String key, String value)
50 if ((key==null)||(key.equals(""))||(value==null)||(value.equals("")))
51 return;
53 String ex = (String)h.get(key);
54 if (ex==null)
55 h.put(key,value);
56 else
57 h.put(key,ex+" "+value);
60 public final Enumeration keys()
62 return h.keys();