From 14bbba0980e3021dcff902bd326d4ba721e8843a Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 3 Apr 2013 17:37:19 -0500 Subject: [PATCH] Optimization to method for getting values in ArgumentMatch * Very trivial, but I happened to see this code and it drove me nuts so I felt compelled to refactor it. * Instead of iterating over keys in map to get the values, just iterate over the values... --- .../broadinstitute/sting/commandline/ArgumentMatch.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/commandline/ArgumentMatch.java b/public/java/src/org/broadinstitute/sting/commandline/ArgumentMatch.java index 828f10fcb..e354601da 100644 --- a/public/java/src/org/broadinstitute/sting/commandline/ArgumentMatch.java +++ b/public/java/src/org/broadinstitute/sting/commandline/ArgumentMatch.java @@ -276,10 +276,10 @@ public class ArgumentMatch implements Iterable { * @return A collection of the string representation of these value. */ public List values() { - List values = new ArrayList(); - for( ArgumentMatchSite site: sites.keySet() ) { - if( sites.get(site) != null ) - values.addAll(sites.get(site)); + final List values = new ArrayList(); + for ( final List siteValue : sites.values() ) { + if ( siteValue != null ) + values.addAll(siteValue); } return values; }