org.apache.solr.common.util
Class SimpleOrderedMap<T>

java.lang.Object
  extended by org.apache.solr.common.util.NamedList<T>
      extended by org.apache.solr.common.util.SimpleOrderedMap<T>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Map.Entry<String,T>>

public class SimpleOrderedMap<T>
extends NamedList<T>

SimpleOrderedMap is a NamedList where access by key is more important than maintaining order when it comes to representing the held data in other forms, as ResponseWriters normally do. It's normally not a good idea to repeat keys or use null keys, but this is not enforced. If key uniqueness enforcement is desired, use a regular Map.

For example, a JSON response writer may choose to write a SimpleOrderedMap as {"foo":10,"bar":20} and may choose to write a NamedList as ["foo",10,"bar",20]. An XML response writer may choose to render both the same way.

This class does not provide efficient lookup by key, it's main purpose is to hold data to be serialized. It aims to minimize overhead and to be efficient at adding new elements.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.solr.common.util.NamedList
NamedList.NamedListEntry<T>
 
Field Summary
 
Fields inherited from class org.apache.solr.common.util.NamedList
nvPairs
 
Constructor Summary
SimpleOrderedMap()
          Creates an empty instance
SimpleOrderedMap(List<Object> nameValuePairs)
          Deprecated. 
SimpleOrderedMap(Map.Entry<String,T>[] nameValuePairs)
           
 
Method Summary
 SimpleOrderedMap<T> clone()
          Makes a shallow copy of the named list.
 
Methods inherited from class org.apache.solr.common.util.NamedList
add, addAll, addAll, clear, equals, findRecursive, get, get, getAll, getName, getVal, hashCode, indexOf, iterator, remove, remove, removeAll, removeBooleanArg, removeConfigArgs, setName, setVal, size, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleOrderedMap

public SimpleOrderedMap()
Creates an empty instance


SimpleOrderedMap

@Deprecated
public SimpleOrderedMap(List<Object> nameValuePairs)
Deprecated. 

Creates an instance backed by an explicitly specified list of pairwise names/values.

Parameters:
nameValuePairs - underlying List which should be used to implement a SimpleOrderedMap; modifying this List will affect the SimpleOrderedMap.

SimpleOrderedMap

public SimpleOrderedMap(Map.Entry<String,T>[] nameValuePairs)
Method Detail

clone

public SimpleOrderedMap<T> clone()
Description copied from class: NamedList
Makes a shallow copy of the named list.

Overrides:
clone in class NamedList<T>


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.