Java Doc for Vector.java in  » 6.0-JDK-Modules » j2me » 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 » 6.0 JDK Modules » j2me » java.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.Vector

All known Subclasses:   java.util.Stack,  makedep.FileList,  sun.security.x509.AttributeNameEnumeration,
Vector
public class Vector (Code)
The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index. However, the size of a Vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created.

Each vector tries to optimize storage management by maintaining a capacity and a capacityIncrement. The capacity is always at least as large as the vector size; it is usually larger because as components are added to the vector, the vector's storage increases in chunks the size of capacityIncrement. An application can increase the capacity of a vector before inserting a large number of components; this reduces the amount of incremental reallocation.
version:
   12/17/01 (CLDC 1.1)
since:
   JDK1.0, CLDC 1.0



Field Summary
protected  intcapacityIncrement
     The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity.
protected  intelementCount
     The number of valid components in the vector.
protected  ObjectelementData
     The array buffer into which the components of the vector are stored.

Constructor Summary
public  Vector(int initialCapacity, int capacityIncrement)
     Constructs an empty vector with the specified initial capacity and capacity increment.
public  Vector(int initialCapacity)
     Constructs an empty vector with the specified initial capacity.
public  Vector()
     Constructs an empty vector.

Method Summary
public synchronized  voidaddElement(Object obj)
     Adds the specified component to the end of this vector, increasing its size by one.
public  intcapacity()
     Returns the current capacity of this vector.
public  booleancontains(Object elem)
     Tests if the specified object is a component in this vector.
Parameters:
  elem - an object.
public synchronized  voidcopyInto(Object anArray)
     Copies the components of this vector into the specified array.
public synchronized  ObjectelementAt(int index)
     Returns the component at the specified index.
Parameters:
  index - an index into this vector.
public synchronized  Enumerationelements()
     Returns an enumeration of the components of this vector.
public synchronized  voidensureCapacity(int minCapacity)
     Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.
public synchronized  ObjectfirstElement()
     Returns the first component of this vector.
public  intindexOf(Object elem)
     Searches for the first occurrence of the given argument, testing for equality using the equals method.
Parameters:
  elem - an object.
public synchronized  intindexOf(Object elem, int index)
     Searches for the first occurrence of the given argument, beginning the search at index, and testing for equality using the equals method.
Parameters:
  elem - an object.
Parameters:
  index - the index to start searching from.
public synchronized  voidinsertElementAt(Object obj, int index)
     Inserts the specified object as a component in this vector at the specified index.
public  booleanisEmpty()
     Tests if this vector has no components.
public synchronized  ObjectlastElement()
     Returns the last component of the vector.
public  intlastIndexOf(Object elem)
     Returns the index of the last occurrence of the specified object in this vector.
Parameters:
  elem - the desired component.
public synchronized  intlastIndexOf(Object elem, int index)
     Searches backwards for the specified object, starting from the specified index, and returns an index to it.
Parameters:
  elem - the desired component.
Parameters:
  index - the index to start searching from.
public synchronized  voidremoveAllElements()
     Removes all components from this vector and sets its size to zero.
public synchronized  booleanremoveElement(Object obj)
     Removes the first occurrence of the argument from this vector.
public synchronized  voidremoveElementAt(int index)
     Deletes the component at the specified index.
public synchronized  voidsetElementAt(Object obj, int index)
     Sets the component at the specified index of this vector to be the specified object.
public synchronized  voidsetSize(int newSize)
     Sets the size of this vector.
public  intsize()
     Returns the number of components in this vector.
public synchronized  StringtoString()
     Returns a string representation of this vector.
public synchronized  voidtrimToSize()
     Trims the capacity of this vector to be the vector's current size.

Field Detail
capacityIncrement
protected int capacityIncrement(Code)
The amount by which the capacity of the vector is automatically incremented when its size becomes greater than its capacity. If the capacity increment is 0, the capacity of the vector is doubled each time it needs to grow.
since:
   JDK1.0



elementCount
protected int elementCount(Code)
The number of valid components in the vector.
since:
   JDK1.0



elementData
protected Object elementData(Code)
The array buffer into which the components of the vector are stored. The capacity of the vector is the length of this array buffer.
since:
   JDK1.0




Constructor Detail
Vector
public Vector(int initialCapacity, int capacityIncrement)(Code)
Constructs an empty vector with the specified initial capacity and capacity increment.
Parameters:
  initialCapacity - the initial capacity of the vector.
Parameters:
  capacityIncrement - the amount by which the capacity isincreased when the vector overflows.
exception:
  IllegalArgumentException - if the specified initial capacityis negative



Vector
public Vector(int initialCapacity)(Code)
Constructs an empty vector with the specified initial capacity.
Parameters:
  initialCapacity - the initial capacity of the vector.
since:
   JDK1.0



Vector
public Vector()(Code)
Constructs an empty vector.
since:
   JDK1.0




Method Detail
addElement
public synchronized void addElement(Object obj)(Code)
Adds the specified component to the end of this vector, increasing its size by one. The capacity of this vector is increased if its size becomes greater than its capacity.
Parameters:
  obj - the component to be added.
since:
   JDK1.0



capacity
public int capacity()(Code)
Returns the current capacity of this vector. the current capacity of this vector.
since:
   JDK1.0



contains
public boolean contains(Object elem)(Code)
Tests if the specified object is a component in this vector.
Parameters:
  elem - an object. true if the specified object is a component inthis vector; false otherwise.
since:
   JDK1.0



copyInto
public synchronized void copyInto(Object anArray)(Code)
Copies the components of this vector into the specified array. The array must be big enough to hold all the objects in this vector.
Parameters:
  anArray - the array into which the components get copied.
since:
   JDK1.0



elementAt
public synchronized Object elementAt(int index)(Code)
Returns the component at the specified index.
Parameters:
  index - an index into this vector. the component at the specified index.
exception:
  ArrayIndexOutOfBoundsException - if an invalid index wasgiven.
since:
   JDK1.0



elements
public synchronized Enumeration elements()(Code)
Returns an enumeration of the components of this vector. an enumeration of the components of this vector.
See Also:   java.util.Enumeration
since:
   JDK1.0



ensureCapacity
public synchronized void ensureCapacity(int minCapacity)(Code)
Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.
Parameters:
  minCapacity - the desired minimum capacity.
since:
   JDK1.0



firstElement
public synchronized Object firstElement()(Code)
Returns the first component of this vector. the first component of this vector.
exception:
  NoSuchElementException - if this vector has no components.
since:
   JDK1.0



indexOf
public int indexOf(Object elem)(Code)
Searches for the first occurrence of the given argument, testing for equality using the equals method.
Parameters:
  elem - an object. the index of the first occurrence of the argument in thisvector; returns -1 if the object is not found.
See Also:   java.lang.Object.equals(java.lang.Object)
since:
   JDK1.0



indexOf
public synchronized int indexOf(Object elem, int index)(Code)
Searches for the first occurrence of the given argument, beginning the search at index, and testing for equality using the equals method.
Parameters:
  elem - an object.
Parameters:
  index - the index to start searching from. the index of the first occurrence of the object argument inthis vector at position index or later in thevector; returns -1 if the object is not found.
See Also:   java.lang.Object.equals(java.lang.Object)
since:
   JDK1.0



insertElementAt
public synchronized void insertElementAt(Object obj, int index)(Code)
Inserts the specified object as a component in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously.

The index must be a value greater than or equal to 0 and less than or equal to the current size of the vector.
Parameters:
  obj - the component to insert.
Parameters:
  index - where to insert the new component.
exception:
  ArrayIndexOutOfBoundsException - if the index was invalid.
See Also:   java.util.Vector.size
since:
   JDK1.0




isEmpty
public boolean isEmpty()(Code)
Tests if this vector has no components. true if this vector has no components;false otherwise.
since:
   JDK1.0



lastElement
public synchronized Object lastElement()(Code)
Returns the last component of the vector. the last component of the vector, i.e., the component at indexsize() - 1.
exception:
  NoSuchElementException - if this vector is empty.
since:
   JDK1.0



lastIndexOf
public int lastIndexOf(Object elem)(Code)
Returns the index of the last occurrence of the specified object in this vector.
Parameters:
  elem - the desired component. the index of the last occurrence of the specified object inthis vector; returns -1 if the object is not found.
since:
   JDK1.0



lastIndexOf
public synchronized int lastIndexOf(Object elem, int index)(Code)
Searches backwards for the specified object, starting from the specified index, and returns an index to it.
Parameters:
  elem - the desired component.
Parameters:
  index - the index to start searching from. the index of the last occurrence of the specified object in thisvector at position less than index in the vector;-1 if the object is not found.
exception:
  IndexOutOfBoundsException - if index is greaterthan or equal to the current size of this vector.
since:
   JDK1.0



removeAllElements
public synchronized void removeAllElements()(Code)
Removes all components from this vector and sets its size to zero.
since:
   JDK1.0



removeElement
public synchronized boolean removeElement(Object obj)(Code)
Removes the first occurrence of the argument from this vector. If the object is found in this vector, each component in the vector with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.
Parameters:
  obj - the component to be removed. true if the argument was a component of thisvector; false otherwise.
since:
   JDK1.0



removeElementAt
public synchronized void removeElementAt(int index)(Code)
Deletes the component at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously.

The index must be a value greater than or equal to 0 and less than the current size of the vector.
Parameters:
  index - the index of the object to remove.
exception:
  ArrayIndexOutOfBoundsException - if the index was invalid.
See Also:   java.util.Vector.size
since:
   JDK1.0




setElementAt
public synchronized void setElementAt(Object obj, int index)(Code)
Sets the component at the specified index of this vector to be the specified object. The previous component at that position is discarded.

The index must be a value greater than or equal to 0 and less than the current size of the vector.
Parameters:
  obj - what the component is to be set to.
Parameters:
  index - the specified index.
exception:
  ArrayIndexOutOfBoundsException - if the index was invalid.
See Also:   java.util.Vector.size
since:
   JDK1.0




setSize
public synchronized void setSize(int newSize)(Code)
Sets the size of this vector. If the new size is greater than the current size, new null items are added to the end of the vector. If the new size is less than the current size, all components at index newSize and greater are discarded.
Parameters:
  newSize - the new size of this vector.
throws:
  ArrayIndexOutOfBoundsException - if new size is negative.
since:
   JDK1.0



size
public int size()(Code)
Returns the number of components in this vector. the number of components in this vector.
since:
   JDK1.0



toString
public synchronized String toString()(Code)
Returns a string representation of this vector. a string representation of this vector.
since:
   JDK1.0



trimToSize
public synchronized void trimToSize()(Code)
Trims the capacity of this vector to be the vector's current size. An application can use this operation to minimize the storage of a vector.
since:
   JDK1.0



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.