mirror of https://github.com/apache/lucene.git
SOLR-621: add getAll(name) to NamedList
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@674899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
229229a3c0
commit
d26e5638f1
|
@ -170,6 +170,23 @@ public class NamedList<T> implements Cloneable, Serializable, Iterable<Map.Entry
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the values for the the specified name
|
||||||
|
* @param name Name
|
||||||
|
* @return List of values
|
||||||
|
*/
|
||||||
|
public List<T> getAll(String name) {
|
||||||
|
List<T> result = new ArrayList<T>();
|
||||||
|
int sz = size();
|
||||||
|
for (int i = 0; i < sz; i++) {
|
||||||
|
String n = getName(i);
|
||||||
|
if (name==n || (name!=null && name.equals(n))) {
|
||||||
|
result.add(getVal(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append('{');
|
sb.append('{');
|
||||||
|
|
Loading…
Reference in New Issue