Methods Summary |
---|
public void | clear()Discard all object references held in the collection, i.e.,
reset to its initial state.
names.clear();
values.clear();
|
public boolean | containsKey(java.lang.Object obj)Return true if the given object is contained as a Key
return names.contains(obj);
|
public boolean | containsValue(java.lang.Object obj)Return true if the given object is contained as a Value
return values.contains(obj);
|
public java.util.Set | entrySet()EntrySet (not implemented, returns null)
return null;
|
public java.lang.Object | get(java.lang.Object obj)Get a given object
return values.get(names.indexOf(obj));
|
public boolean | isEmpty()Return true if the Map is empty
return names.isEmpty();
|
public java.util.Set | keySet()Return the set of keys
return new HashSet(names);
|
public void | load(java.lang.String fileName)
if (fileName == null) {
throw new IOException("filename is null!");
}
InputStream is = new FileInputStream(fileName);
BufferedReader rdr = new BufferedReader(
new InputStreamReader(is));
String line;
while ((line = rdr.readLine()) != null) {
int ix = line.indexOf('=");
String name = line.substring(0, ix);
String value = line.substring(ix+1);
names.add(name);
values.add(value);
}
rdr.close();
|
public java.lang.Object | put(java.lang.Object n, java.lang.Object v)Add a given object into this Map.
names.add(n);
values.add(v);
return n;
|
public void | putAll(java.util.Map map)Merge all the values from another map into this map.
Iterator k = map.keySet().iterator();
while (k.hasNext()) {
Object key = k.next();
Object val = map.get(key);
put(key, val);
}
|
public java.lang.Object | remove(java.lang.Object obj)Remove a given object
int i = values.indexOf(obj);
if (i < 0)
throw new IllegalArgumentException("remove(" + obj + ") not found");
names.remove(i);
values.remove(i);
return obj;
|
public int | size()Return the number of entries in the Map
return names.size();
|
public java.util.Collection | values()Return a Collection containing the values
return values;
|