com.darwinsys.util
Class PropertiesMap

java.lang.Object
  extended bycom.darwinsys.util.PropertiesMap
All Implemented Interfaces:
java.util.Map

public class PropertiesMap
extends java.lang.Object
implements java.util.Map

PropertiesMap -- a Map that loads from a Properties file, but unlike Properties, preserves the ordering of the original file.

Written mainly as a demonstration of building a simple Map implementation from scratch, but useful when order matters and yet you want the convenience of Map acccess.

Version:
$Id: PropertiesMap.java,v 1.4 2003/05/29 17:36:28 ian Exp $
Author:
Ian F. Darwin

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
PropertiesMap()
           
 
Method Summary
 void clear()
          Discard all object references held in the collection, i.e., reset to its initial state.
 boolean containsKey(java.lang.Object obj)
          Return true if the given object is contained as a Key
 boolean containsValue(java.lang.Object obj)
          Return true if the given object is contained as a Value
 java.util.Set entrySet()
          EntrySet (not implemented, returns null)
 java.lang.Object get(java.lang.Object obj)
          Get a given object
 boolean isEmpty()
          Return true if the Map is empty
 java.util.Set keySet()
          Return the set of keys
 void load(java.lang.String fileName)
           
 java.lang.Object put(java.lang.Object n, java.lang.Object v)
          Add a given object into this Map.
 void putAll(java.util.Map map)
          Merge all the values from another map into this map.
 java.lang.Object remove(java.lang.Object obj)
          Remove a given object
 int size()
          Return the number of entries in the Map
 java.util.Collection values()
          Return a Collection containing the values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

PropertiesMap

public PropertiesMap()
Method Detail

load

public void load(java.lang.String fileName)
          throws java.io.IOException
Throws:
java.io.IOException

size

public int size()
Return the number of entries in the Map

Specified by:
size in interface java.util.Map

isEmpty

public boolean isEmpty()
Return true if the Map is empty

Specified by:
isEmpty in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object obj)
Return true if the given object is contained as a Key

Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object obj)
Return true if the given object is contained as a Value

Specified by:
containsValue in interface java.util.Map

get

public java.lang.Object get(java.lang.Object obj)
Get a given object

Specified by:
get in interface java.util.Map

put

public java.lang.Object put(java.lang.Object n,
                            java.lang.Object v)
Add a given object into this Map.

Specified by:
put in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object obj)
Remove a given object

Specified by:
remove in interface java.util.Map

putAll

public void putAll(java.util.Map map)
Merge all the values from another map into this map.

Specified by:
putAll in interface java.util.Map

clear

public void clear()
Discard all object references held in the collection, i.e., reset to its initial state.

Specified by:
clear in interface java.util.Map

keySet

public java.util.Set keySet()
Return the set of keys

Specified by:
keySet in interface java.util.Map

values

public java.util.Collection values()
Return a Collection containing the values

Specified by:
values in interface java.util.Map

entrySet

public java.util.Set entrySet()
EntrySet (not implemented, returns null)

Specified by:
entrySet in interface java.util.Map


Copyright © 2000-2003 Ian F. Darwin. See license.html for usage license.