[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Laszlo Biczok <biczok_at_freemail.hu>
Date: Thu, 19 Feb 2009 01:55:32 -0800 (PST)

Hi,

It seems to me, that in org.tigris.subversion.subclipse.core.repo.SVNRepositories.java 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/subversion/subclipse/core/repo/SVNRepositories.java
===================================================================
--- src/org/tigris/subversion/subclipse/core/repo/SVNRepositories.java (revision 4302)
+++ src/org/tigris/subversion/subclipse/core/repo/SVNRepositories.java (working copy)
@@ -380,15 +380,7 @@
          * The location string corresponds to the Strin returned by ISVNRepositoryLocation#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.containsKey(location);
         }
 
 }

------------------------------------------------------
http://subclipse.tigris.org/ds/viewMessage.do?dsForumId=1043&dsMessageId=1191067

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_subclipse.tigris.org].
Received on 2009-02-19 13:29:12 CET

This is an archived mail posted to the Subclipse Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.