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.
|
* @return A collection of the string representation of these value.
|
||||||
*/
|
*/
|
||||||
public List<ArgumentMatchValue> values() {
|
public List<ArgumentMatchValue> values() {
|
||||||
List<ArgumentMatchValue> values = new ArrayList<ArgumentMatchValue>();
|
final List<ArgumentMatchValue> values = new ArrayList<ArgumentMatchValue>();
|
||||||
for( ArgumentMatchSite site: sites.keySet() ) {
|
for ( final List<ArgumentMatchValue> siteValue : sites.values() ) {
|
||||||
if( sites.get(site) != null )
|
if ( siteValue != null )
|
||||||
values.addAll(sites.get(site));
|
values.addAll(siteValue);
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue