Login | Register
My pages Projects Community openCollabNet

Discussions > dev > [Subclipse-dev] [Patch] Unnecessary iteration in SVNRepositories.java

subclipse
Discussion topic

Back to topic list

[Subclipse-dev] [Patch] Unnecessary iteration in SVNRepositories.java

Author laca
Full name Laszlo Biczok
Date 2009-02-19 01:55:32 PST
Message Hi,

It seems to me, that in org.tigris.subversio​n.subclipse.core.rep​o.SVNRepositories.ja​va the method exactMatchExists() unnecessarily loops through the repositories using an iterator. As the repository URL (the key) comparison is case sensitive, a simple repositories.containsKey() is sufficient.

Below is the patch for the change.

Cheers,

Laca

Index: src/org/tigris/subve​rsion/subclipse/core​/repo/SVNRepositorie​s.java
====================​====================​====================​=======
--- src/org/tigris/subve​rsion/subclipse/core​/repo/SVNRepositorie​s.java (revision 4302)
+++ src/org/tigris/subve​rsion/subclipse/core​/repo/SVNRepositorie​s.java (working copy)
@@ -380,15 +380,7 @@
      * The location string corresponds to the Strin returned by ISVNRepositoryLocati​on#getLocation()
      */
     public boolean exactMatchExists(String location) {
- Set keys = repositories.keySet();
- for(Iterator iter = keys.iterator();iter​.hasNext();){
- String url = (String)iter.next();
- if (url.equals(location)){
- return true;
- }
-
- }
- return false;
+ return repositories.contain​sKey(location);
     }
 
 }

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

[Subclipse-dev] [Patch] Unnecessary iteration in SVNRepositories.java laca Laszlo Biczok 2009-02-19 01:55:32 PST
Messages per page: