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...
This commit is contained in:
parent
03811b4274
commit
14bbba0980
|
|
@ -276,10 +276,10 @@ public class ArgumentMatch implements Iterable<ArgumentMatch> {
|
|||
* @return A collection of the string representation of these value.
|
||||
*/
|
||||
public List<ArgumentMatchValue> values() {
|
||||
List<ArgumentMatchValue> values = new ArrayList<ArgumentMatchValue>();
|
||||
for( ArgumentMatchSite site: sites.keySet() ) {
|
||||
if( sites.get(site) != null )
|
||||
values.addAll(sites.get(site));
|
||||
final List<ArgumentMatchValue> values = new ArrayList<ArgumentMatchValue>();
|
||||
for ( final List<ArgumentMatchValue> siteValue : sites.values() ) {
|
||||
if ( siteValue != null )
|
||||
values.addAll(siteValue);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue