Java Doc for TreeMap.java in  » Apache-Harmony-Java-SE » java-package » java » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.util.TreeMap

TreeMap
public class TreeMap extends AbstractMap implements SortedMap<K, V>,Cloneable,Serializable(Code)
TreeMap is an implementation of SortedMap. All optional operations are supported, adding and removing. The values can be any objects. The keys can be any objects which are comparable to each other either using their natural order or a specified Comparator.
since:
   1.2

Inner Class :class MapEntry implements Map.Entry<K, V>,Cloneable
Inner Class :static class Node implements Cloneable
Inner Class :static class AbstractMapIterator
Inner Class :static class UnboundedEntryIterator extends AbstractMapIterator implements Iterator<Map.Entry<K, V>>
Inner Class :static class UnboundedKeyIterator extends AbstractMapIterator implements Iterator<K>
Inner Class :static class UnboundedValueIterator extends AbstractMapIterator implements Iterator<V>
Inner Class :static class BoundedMapIterator extends AbstractMapIterator
Inner Class :static class BoundedEntryIterator extends BoundedMapIterator implements Iterator<Map.Entry<K, V>>
Inner Class :static class BoundedKeyIterator extends BoundedMapIterator implements Iterator<K>
Inner Class :static class BoundedValueIterator extends BoundedMapIterator implements Iterator<V>
Inner Class :final static class SubMap extends AbstractMap implements SortedMap<K, V>,Serializable
Inner Class :static class SubMapEntrySet extends AbstractSet> implements Set<Map.Entry<K, V>>
Inner Class :static class SubMapKeySet extends AbstractSet implements Set<K>
Inner Class :static class SubMapValuesCollection extends AbstractCollection

Field Summary
transient  Set<Map.Entry<K, V>>entrySet
    
transient  intmodCount
    
transient  Node<K, V>root
    
transient  intsize
    

Constructor Summary
public  TreeMap()
     Constructs a new empty instance of spec.TreeMap.
public  TreeMap(Comparator<? super K> comparator)
     Constructs a new empty instance of spec.TreeMap which uses the specified Comparator.
public  TreeMap(Map<? extends K, ? extends V> map)
     Constructs a new instance of spec.TreeMap containing the mappings from the specified Map and using the natural ordering.
public  TreeMap(SortedMap<K, ? extends V> map)
     Constructs a new instance of spec.TreeMap containing the mappings from the specified SortedMap and using the same Comparator.

Method Summary
 Node<K, V>addToLast(Node<K, V> last, K key, V value)
    
 voidbalance(Node<K, V> x)
    
public  voidclear()
     Removes all mappings from this spec.TreeMap, leaving it empty.
public  Objectclone()
     Answers a new spec.TreeMap with the same mappings, size and comparator as this spec.TreeMap.
public  Comparator<? super K>comparator()
     Answers the Comparator used to compare elements in this spec.TreeMap.
public  booleancontainsKey(Object key)
     Searches this spec.TreeMap for the specified key.
public  booleancontainsValue(Object value)
     Searches this spec.TreeMap for the specified value.
public  Set<Map.Entry<K, V>>entrySet()
     Answers a Set of the mappings contained in this spec.TreeMap.
public  KfirstKey()
     Answers the first sorted key in this spec.TreeMap.
public  Vget(Object key)
     Answers the value of the mapping with the specified key.
public  SortedMap<K, V>headMap(K endKey)
     Answers a SortedMap of the specified portion of this spec.TreeMap which contains keys less than the end key.
public  Set<K>keySet()
     Answers a Set of the keys contained in this spec.TreeMap.
public  KlastKey()
     Answer the last sorted key in this spec.TreeMap.
static  Node<K, V>maximum(Node<K, V> x)
    
static  Node<K, V>minimum(Node<K, V> x)
    
public  Vput(K key, V value)
     Maps the specified key to the specified value.
public  voidputAll(Map<? extends K, ? extends V> map)
     Copies every mapping in the specified Map to this spec.TreeMap.
public  Vremove(Object key)
     Removes a mapping with the specified key from this spec.TreeMap.
 voidremoveFromIterator(Node<K, V> node, int index)
    
 voidremoveLeftmost(Node<K, V> node)
    
 voidremoveMiddleElement(Node<K, V> node, int index)
    
 voidremoveRightmost(Node<K, V> node)
    
public  intsize()
     Answers the number of mappings in this spec.TreeMap.
public  SortedMap<K, V>subMap(K startKey, K endKey)
     Answers a SortedMap of the specified portion of this spec.TreeMap which contains keys greater or equal to the start key but less than the end key.
public  SortedMap<K, V>tailMap(K startKey)
     Answers a SortedMap of the specified portion of this spec.TreeMap which contains keys greater or equal to the start key.
public  Collection<V>values()
     Answers a Collection of the values contained in this spec.TreeMap.

Field Detail
entrySet
transient Set<Map.Entry<K, V>> entrySet(Code)



modCount
transient int modCount(Code)



root
transient Node<K, V> root(Code)



size
transient int size(Code)




Constructor Detail
TreeMap
public TreeMap()(Code)
Constructs a new empty instance of spec.TreeMap.



TreeMap
public TreeMap(Comparator<? super K> comparator)(Code)
Constructs a new empty instance of spec.TreeMap which uses the specified Comparator.
Parameters:
  comparator - the Comparator



TreeMap
public TreeMap(Map<? extends K, ? extends V> map)(Code)
Constructs a new instance of spec.TreeMap containing the mappings from the specified Map and using the natural ordering.
Parameters:
  map - the mappings to add
throws:
  ClassCastException - when a key in the Map does not implement the Comparableinterface, or they keys in the Map cannot be compared



TreeMap
public TreeMap(SortedMap<K, ? extends V> map)(Code)
Constructs a new instance of spec.TreeMap containing the mappings from the specified SortedMap and using the same Comparator.
Parameters:
  map - the mappings to add




Method Detail
addToLast
Node<K, V> addToLast(Node<K, V> last, K key, V value)(Code)



balance
void balance(Node<K, V> x)(Code)



clear
public void clear()(Code)
Removes all mappings from this spec.TreeMap, leaving it empty.
See Also:   Map.isEmpty
See Also:   TreeMap.size



clone
public Object clone()(Code)
Answers a new spec.TreeMap with the same mappings, size and comparator as this spec.TreeMap. a shallow copy of this spec.TreeMap
See Also:   java.lang.Cloneable



comparator
public Comparator<? super K> comparator()(Code)
Answers the Comparator used to compare elements in this spec.TreeMap. a Comparator or null if the natural ordering is used



containsKey
public boolean containsKey(Object key)(Code)
Searches this spec.TreeMap for the specified key.
Parameters:
  key - the object to search for true if key is a key of this spec.TreeMap, falseotherwise
throws:
  ClassCastException - when the key cannot be compared with the keys in thisspec.TreeMap
throws:
  NullPointerException - when the key is null and the comparator cannot handle null



containsValue
public boolean containsValue(Object value)(Code)
Searches this spec.TreeMap for the specified value.
Parameters:
  value - the object to search for true if value is a value of this spec.TreeMap, falseotherwise



entrySet
public Set<Map.Entry<K, V>> entrySet()(Code)
Answers a Set of the mappings contained in this spec.TreeMap. Each element in the set is a Map.Entry. The set is backed by this spec.TreeMap so changes to one are reflected by the other. The set does not support adding. a Set of the mappings



firstKey
public K firstKey()(Code)
Answers the first sorted key in this spec.TreeMap. the first sorted key
throws:
  NoSuchElementException - when this spec.TreeMap is empty



get
public V get(Object key)(Code)
Answers the value of the mapping with the specified key.
Parameters:
  key - the key the value of the mapping with the specified key
throws:
  ClassCastException - when the key cannot be compared with the keys in thisspec.TreeMap
throws:
  NullPointerException - when the key is null and the comparator cannot handle null



headMap
public SortedMap<K, V> headMap(K endKey)(Code)
Answers a SortedMap of the specified portion of this spec.TreeMap which contains keys less than the end key. The returned SortedMap is backed by this spec.TreeMap so changes to one are reflected by the other.
Parameters:
  endKey - the end key a sub-map where the keys are less than endKey
throws:
  ClassCastException - when the end key cannot be compared with the keys in thisspec.TreeMap
throws:
  NullPointerException - when the end key is null and the comparator cannot handlenull



keySet
public Set<K> keySet()(Code)
Answers a Set of the keys contained in this spec.TreeMap. The set is backed by this spec.TreeMap so changes to one are reflected by the other. The set does not support adding. a Set of the keys



lastKey
public K lastKey()(Code)
Answer the last sorted key in this spec.TreeMap. the last sorted key
throws:
  NoSuchElementException - when this spec.TreeMap is empty



maximum
static Node<K, V> maximum(Node<K, V> x)(Code)



minimum
static Node<K, V> minimum(Node<K, V> x)(Code)



put
public V put(K key, V value)(Code)
Maps the specified key to the specified value.
Parameters:
  key - the key
Parameters:
  value - the value the value of any previous mapping with the specified key or nullif there was no mapping
throws:
  ClassCastException - when the key cannot be compared with the keys in thisspec.TreeMap
throws:
  NullPointerException - when the key is null and the comparator cannot handle null



putAll
public void putAll(Map<? extends K, ? extends V> map)(Code)
Copies every mapping in the specified Map to this spec.TreeMap.
Parameters:
  map - the Map to copy mappings from
throws:
  ClassCastException - when a key in the Map cannot be compared with the keys inthis spec.TreeMap
throws:
  NullPointerException - when a key in the Map is null and the comparator cannothandle null



remove
public V remove(Object key)(Code)
Removes a mapping with the specified key from this spec.TreeMap.
Parameters:
  key - the key of the mapping to remove the value of the removed mapping or null if key is not a key inthis spec.TreeMap
throws:
  ClassCastException - when the key cannot be compared with the keys in thisspec.TreeMap
throws:
  NullPointerException - when the key is null and the comparator cannot handle null



removeFromIterator
void removeFromIterator(Node<K, V> node, int index)(Code)



removeLeftmost
void removeLeftmost(Node<K, V> node)(Code)



removeMiddleElement
void removeMiddleElement(Node<K, V> node, int index)(Code)



removeRightmost
void removeRightmost(Node<K, V> node)(Code)



size
public int size()(Code)
Answers the number of mappings in this spec.TreeMap. the number of mappings in this spec.TreeMap



subMap
public SortedMap<K, V> subMap(K startKey, K endKey)(Code)
Answers a SortedMap of the specified portion of this spec.TreeMap which contains keys greater or equal to the start key but less than the end key. The returned SortedMap is backed by this spec.TreeMap so changes to one are reflected by the other.
Parameters:
  startKey - the start key
Parameters:
  endKey - the end key a sub-map where the keys are greater or equal tostartKey and less than endKey
throws:
  ClassCastException - when the start or end key cannot be compared with the keysin this spec.TreeMap
throws:
  NullPointerException - when the start or end key is null and the comparatorcannot handle null



tailMap
public SortedMap<K, V> tailMap(K startKey)(Code)
Answers a SortedMap of the specified portion of this spec.TreeMap which contains keys greater or equal to the start key. The returned SortedMap is backed by this spec.TreeMap so changes to one are reflected by the other.
Parameters:
  startKey - the start key a sub-map where the keys are greater or equal tostartKey
throws:
  ClassCastException - when the start key cannot be compared with the keys inthis spec.TreeMap
throws:
  NullPointerException - when the start key is null and the comparator cannothandle null



values
public Collection<V> values()(Code)
Answers a Collection of the values contained in this spec.TreeMap. The collection is backed by this spec.TreeMap so changes to one are reflected by the other. The collection does not support adding. a Collection of the values



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.