|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.solr.util.NamedList
public class NamedList
A simple container class for modeling an ordered list of name/value pairs.
Unlike Maps:
:TODO: In the future, it would be nice if this extended Map or Collection, had iterators, used java5 generics, had a faster lookup for large lists, etc... It could also have an interface, and multiple implementations. One might have indexed lookup, one might not.
Field Summary | |
---|---|
protected List |
nvPairs
|
Constructor Summary | |
---|---|
NamedList()
Creates an empty instance |
|
NamedList(List nameValuePairs)
Creates an instance backed by an explicitly specified list of pairwise names/values. |
Method Summary | |
---|---|
void |
add(String name,
Object val)
Adds a name/value pair to the end of the list. |
boolean |
addAll(Map args)
Iterates over the Map and sequentially adds it's key/value pairs |
boolean |
addAll(NamedList nl)
Appends the elements of the given NamedList to this one. |
NamedList |
clone()
Makes a shallow copy of the named list. |
Object |
get(String name)
Gets the value for the first instance of the specified name found. |
Object |
get(String name,
int start)
Gets the value for the first instance of the specified name found starting at the specified index. |
String |
getName(int idx)
The name of the pair at the specified List index |
Object |
getVal(int idx)
The value of the pair at the specified List index |
int |
indexOf(String name,
int start)
Scans the list sequentially beginning at the specified index and returns the index of the first pair with the specified name. |
void |
setName(int idx,
String name)
Modifies the name of the pair at the specified index. |
void |
setVal(int idx,
Object val)
Modifies the value of the pair at the specified index. |
int |
size()
The total number of name/value pairs |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final List nvPairs
Constructor Detail |
---|
public NamedList()
public NamedList(List nameValuePairs)
nameValuePairs
- underlying List which should be used to implement a NamedList; modifying this List will affect the NamedList.Method Detail |
---|
public int size()
public String getName(int idx)
public Object getVal(int idx)
public void add(String name, Object val)
public void setName(int idx, String name)
public void setVal(int idx, Object val)
public int indexOf(String name, int start)
name
- name to look for, may be nullstart
- index to begin searching from
public Object get(String name)
indexOf(java.lang.String, int)
,
get(String,int)
public Object get(String name, int start)
indexOf(java.lang.String, int)
public String toString()
toString
in class Object
public boolean addAll(Map args)
public boolean addAll(NamedList nl)
public NamedList clone()
clone
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |