Java Doc for TreeList.java in  » Library » Apache-common-Collections » org » apache » commons » collections » list » 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 » Library » Apache common Collections » org.apache.commons.collections.list 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.util.AbstractList
   org.apache.commons.collections.list.TreeList

TreeList
public class TreeList extends AbstractList (Code)
A List implementation that is optimised for fast insertions and removals at any index in the list.

This list implementation utilises a tree structure internally to ensure that all insertions and removals are O(log n). This provides much faster performance than both an ArrayList and a LinkedList where elements are inserted and removed repeatedly from anywhere in the list.

The following relative performance statistics are indicative of this class:

 get  add  insert  iterate  remove
 TreeList       3    5       1       2       1
 ArrayList      1    1      40       1      40
 LinkedList  5800    1     350       2     325
 
ArrayList is a good general purpose list implementation. It is faster than TreeList for most operations except inserting and removing in the middle of the list. ArrayList also uses less memory as TreeList uses one object per entry.

LinkedList is rarely a good choice of implementation. TreeList is almost always a good replacement for it, although it does use sligtly more memory.
since:
   Commons Collections 3.1
version:
   $Revision: 370952 $ $Date: 2006-01-21 01:49:21 +0000 (Sat, 21 Jan 2006) $
author:
   Joerg Schmuecker
author:
   Stephen Colebourne


Inner Class :static class AVLNode
Inner Class :static class TreeListIterator implements ListIterator,OrderedIterator


Constructor Summary
public  TreeList()
     Constructs a new empty list.
public  TreeList(Collection coll)
     Constructs a new empty list that copies the specified list.

Method Summary
public  voidadd(int index, Object obj)
     Adds a new element to the list.
public  voidclear()
     Clears the list, removing all entries.
public  booleancontains(Object object)
     Searches for the presence of an object in the list.
public  Objectget(int index)
     Gets the element at the specified index.
public  intindexOf(Object object)
     Searches for the index of an object in the list.
public  Iteratoriterator()
     Gets an iterator over the list.
public  ListIteratorlistIterator()
     Gets a ListIterator over the list.
public  ListIteratorlistIterator(int fromIndex)
     Gets a ListIterator over the list.
public  Objectremove(int index)
     Removes the element at the specified index.
public  Objectset(int index, Object obj)
     Sets the element at the specified index.
public  intsize()
     Gets the current size of the list.
public  Object[]toArray()
     Converts the list into an array.


Constructor Detail
TreeList
public TreeList()(Code)
Constructs a new empty list.



TreeList
public TreeList(Collection coll)(Code)
Constructs a new empty list that copies the specified list.
Parameters:
  coll - the collection to copy
throws:
  NullPointerException - if the collection is null




Method Detail
add
public void add(int index, Object obj)(Code)
Adds a new element to the list.
Parameters:
  index - the index to add before
Parameters:
  obj - the element to add



clear
public void clear()(Code)
Clears the list, removing all entries.



contains
public boolean contains(Object object)(Code)
Searches for the presence of an object in the list. true if the object is found



get
public Object get(int index)(Code)
Gets the element at the specified index.
Parameters:
  index - the index to retrieve the element at the specified index



indexOf
public int indexOf(Object object)(Code)
Searches for the index of an object in the list. the index of the object, -1 if not found



iterator
public Iterator iterator()(Code)
Gets an iterator over the list. an iterator over the list



listIterator
public ListIterator listIterator()(Code)
Gets a ListIterator over the list. the new iterator



listIterator
public ListIterator listIterator(int fromIndex)(Code)
Gets a ListIterator over the list.
Parameters:
  fromIndex - the index to start from the new iterator



remove
public Object remove(int index)(Code)
Removes the element at the specified index.
Parameters:
  index - the index to remove the previous object at that index



set
public Object set(int index, Object obj)(Code)
Sets the element at the specified index.
Parameters:
  index - the index to set
Parameters:
  obj - the object to store at the specified index the previous object at that index
throws:
  IndexOutOfBoundsException - if the index is invalid



size
public int size()(Code)
Gets the current size of the list. the current size



toArray
public Object[] toArray()(Code)
Converts the list into an array. the list as an array



Fields inherited from java.util.AbstractList
protected transient int modCount(Code)(Java Doc)

Methods inherited from java.util.AbstractList
public boolean add(E e)(Code)(Java Doc)
public void add(int index, E element)(Code)(Java Doc)
public boolean addAll(int index, Collection<? extends E> c)(Code)(Java Doc)
public void clear()(Code)(Java Doc)
public boolean equals(Object o)(Code)(Java Doc)
abstract public E get(int index)(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public int indexOf(Object o)(Code)(Java Doc)
public Iterator<E> iterator()(Code)(Java Doc)
public int lastIndexOf(Object o)(Code)(Java Doc)
public ListIterator<E> listIterator()(Code)(Java Doc)
public ListIterator<E> listIterator(int index)(Code)(Java Doc)
public E remove(int index)(Code)(Java Doc)
protected void removeRange(int fromIndex, int toIndex)(Code)(Java Doc)
public E set(int index, E element)(Code)(Java Doc)
public List<E> subList(int fromIndex, int toIndex)(Code)(Java Doc)

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