diff options
author | Tom Tromey <tromey@redhat.com> | 2006-12-18 16:47:09 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2006-12-18 16:47:09 +0000 |
commit | aa0a5322b1e384e251a2139d1d8ecc5179b46782 (patch) | |
tree | 6fae8b5e0cf1e427adb99d33f13d0eee6d7a5dbe /gnu/java/util | |
parent | 196a62c4f4120373a2ab723d1d55c5aaa3d7d1ca (diff) | |
download | classpath-aa0a5322b1e384e251a2139d1d8ecc5179b46782.tar.gz |
* java/util/prefs/Preferences.java (getFactory): Genericized.
* java/util/prefs/AbstractPreferences.java (childCache): Genericized.
(nodeListeners): Likewise.
(preferenceListeners): Likewise.
(cachedChildren): Rewrote.
(childrenNames): Updated.
(addNodeChangeListener): Likewise.
(addPreferenceChangeListener): Likewise.
* gnu/java/util/prefs/gconf/GConfNativePeer.java (getKeys):
Genericized.
(getChildrenNodes): Likewise.
(gconf_client_all_nodes): Likewise.
(gconf_client_all_keys): Likewise.
* gnu/java/util/prefs/MemoryBasedPreferences.java (entries):
Genericized.
(keysSpi): Likewise.
(getSpi): Likewise.
* gnu/java/util/prefs/GConfBasedPreferences.java (childrenNamesSpi):
Genericized.
(keysSpi): Likewise.
(postorderRemove): Likewise.
* gnu/java/util/prefs/EventDispatcher.java (queue): Genericized.
(run): Updated.
Diffstat (limited to 'gnu/java/util')
-rw-r--r-- | gnu/java/util/prefs/EventDispatcher.java | 4 | ||||
-rw-r--r-- | gnu/java/util/prefs/GConfBasedPreferences.java | 20 | ||||
-rw-r--r-- | gnu/java/util/prefs/MemoryBasedPreferences.java | 6 | ||||
-rw-r--r-- | gnu/java/util/prefs/gconf/GConfNativePeer.java | 8 |
4 files changed, 15 insertions, 23 deletions
diff --git a/gnu/java/util/prefs/EventDispatcher.java b/gnu/java/util/prefs/EventDispatcher.java index ecddd3a55..f73c3e703 100644 --- a/gnu/java/util/prefs/EventDispatcher.java +++ b/gnu/java/util/prefs/EventDispatcher.java @@ -53,7 +53,7 @@ public class EventDispatcher extends Thread // This is a queue of events to dispatch. This thread waits on // the queue and when notified will remove events until the queue // is empty. - private static final ArrayList queue = new ArrayList(); + private static final ArrayList<Runnable> queue = new ArrayList<Runnable>(); // FIXME: this thread probably ought to go in some classpath-internal // ThreadGroup. But we don't have that yet. @@ -81,7 +81,7 @@ public class EventDispatcher extends Thread // Ignore. } } - r = (Runnable) queue.remove(0); + r = queue.remove(0); } // Invoke outside the synchronization, so that // we aren't blocking other threads from posting events. diff --git a/gnu/java/util/prefs/GConfBasedPreferences.java b/gnu/java/util/prefs/GConfBasedPreferences.java index a7e2322b5..0fd4df366 100644 --- a/gnu/java/util/prefs/GConfBasedPreferences.java +++ b/gnu/java/util/prefs/GConfBasedPreferences.java @@ -41,7 +41,6 @@ import gnu.java.util.prefs.gconf.GConfNativePeer; import java.security.Permission; -import java.util.Iterator; import java.util.List; import java.util.prefs.AbstractPreferences; import java.util.prefs.BackingStoreException; @@ -185,7 +184,7 @@ public class GConfBasedPreferences */ protected String[] childrenNamesSpi() throws BackingStoreException { - List nodeList = backend.getChildrenNodes(this.node); + List<String> nodeList = backend.getChildrenNodes(this.node); String[] nodes = new String[nodeList.size()]; nodeList.toArray(nodes); @@ -228,7 +227,7 @@ public class GConfBasedPreferences */ protected String[] keysSpi() throws BackingStoreException { - List keyList = backend.getKeys(this.node); + List<String> keyList = backend.getKeys(this.node); String[] keys = new String[keyList.size()]; keyList.toArray(keys); @@ -246,31 +245,24 @@ public class GConfBasedPreferences try { // gets the listing of directories in this node - List dirs = backend.getChildrenNodes(directory); + List<String> dirs = backend.getChildrenNodes(directory); if (dirs.size() != 0) { - String currentDir = null; - - for (Iterator itr = dirs.iterator(); itr.hasNext();) + for (String currentDir : dirs) { - currentDir = (String) itr.next(); - // recursive search inside this directory postorderRemove(currentDir); } } // remove all the keys associated to this directory - List entries = backend.getKeys(directory); + List<String> entries = backend.getKeys(directory); if (entries.size() != 0) { - String key = null; - - for (Iterator keys = entries.iterator(); keys.hasNext();) + for (String key : entries) { - key = (String) keys.next(); this.removeSpi(key); } } diff --git a/gnu/java/util/prefs/MemoryBasedPreferences.java b/gnu/java/util/prefs/MemoryBasedPreferences.java index cccb9bf2f..dc8237916 100644 --- a/gnu/java/util/prefs/MemoryBasedPreferences.java +++ b/gnu/java/util/prefs/MemoryBasedPreferences.java @@ -52,7 +52,7 @@ public class MemoryBasedPreferences extends AbstractPreferences { private final boolean isUser; /** Contains all the preference entries of this node. */ - private HashMap entries = new HashMap(); + private HashMap<String, String> entries = new HashMap<String, String>(); /** * Creates a new preferences node with the given name and parent. @@ -98,7 +98,7 @@ public class MemoryBasedPreferences extends AbstractPreferences { * this node. */ protected String[] keysSpi() throws BackingStoreException { - return (String[]) entries.keySet().toArray(new String[entries.size()]); + return entries.keySet().toArray(new String[entries.size()]); } /** @@ -106,7 +106,7 @@ public class MemoryBasedPreferences extends AbstractPreferences { * null when the key has not been set. */ protected String getSpi(String key) { - return (String) entries.get(key); + return entries.get(key); } /** diff --git a/gnu/java/util/prefs/gconf/GConfNativePeer.java b/gnu/java/util/prefs/gconf/GConfNativePeer.java index 6049863e9..5e12c718b 100644 --- a/gnu/java/util/prefs/gconf/GConfNativePeer.java +++ b/gnu/java/util/prefs/gconf/GConfNativePeer.java @@ -147,7 +147,7 @@ public final class GConfNativePeer * @return a java.util.List of keys. If there are no keys in the given node, a * list of size 0 is returned. */ - public List getKeys(String node) throws BackingStoreException + public List<String> getKeys(String node) throws BackingStoreException { return gconf_client_all_keys(node); } @@ -159,7 +159,7 @@ public final class GConfNativePeer * @param node the node to get subnodes from. If there are no subnodes in the * given node, a list of size 0 is returned. */ - public List getChildrenNodes(String node) throws BackingStoreException + public List<String> getChildrenNodes(String node) throws BackingStoreException { return gconf_client_all_nodes(node); } @@ -295,7 +295,7 @@ public final class GConfNativePeer * @return A list of nodes under the given source node. */ native - static final protected List gconf_client_all_nodes(String node) + static final protected List<String> gconf_client_all_nodes(String node) throws BackingStoreException; /** @@ -305,7 +305,7 @@ public final class GConfNativePeer * @return A list of all keys stored in the given node. */ native - static final protected List gconf_client_all_keys(String node) + static final protected List<String> gconf_client_all_keys(String node) throws BackingStoreException; /** |