Java Doc for Vector.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.Vector

Vector
public class Vector extends AbstractList implements List<E>,RandomAccess,Cloneable,Serializable(Code)
Vector is a variable size contiguous indexable array of Objects. The size of the Vector is the number of Objects it contains. The capacity of the Vector is the number of Objects it can hold.

Objects may be inserted at any position up to the size of the Vector, increasing the size of the Vector. Objects at any position in the Vector may be removed, shrinking the size of the Vector. Objects at any position in the Vector may be replaced, which does not affect the Vector size.

The capacity of a Vector may be specified when the Vector is created. If the capacity of the Vector is exceeded, the capacity is increased, doubling by default.
See Also:   java.lang.StringBuffer



Field Summary
protected  intcapacityIncrement
     How many elements should be added to the vector when it is detected that it needs to grow to accommodate extra entries.
protected  intelementCount
     The number of elements or the size of the vector.
protected  Object[]elementData
     The elements of the vector.

Constructor Summary
public  Vector()
     Constructs a new Vector using the default capacity.
public  Vector(int capacity)
     Constructs a new Vector using the specified capacity.
public  Vector(int capacity, int capacityIncrement)
     Constructs a new Vector using the specified capacity and capacity increment.
public  Vector(Collection<? extends E> collection)
     Constructs a new instance of Vector containing the elements in collection.

Method Summary
public  voidadd(int location, E object)
     Adds the specified object into this Vector at the specified location.
public synchronized  booleanadd(E object)
     Adds the specified object at the end of this Vector.
public synchronized  booleanaddAll(int location, Collection<? extends E> collection)
     Inserts the objects in the specified Collection at the specified location in this Vector.
public synchronized  booleanaddAll(Collection<? extends E> collection)
     Adds the objects in the specified Collection to the end of this Vector.
public synchronized  voidaddElement(E object)
     Adds the specified object at the end of this Vector.
public synchronized  intcapacity()
     Answers the number of elements this Vector can hold without growing.
public  voidclear()
     Removes all elements from this Vector, leaving it empty.
public synchronized  Objectclone()
     Answers a new Vector with the same elements, size, capacity and capacity increment as this Vector.
public  booleancontains(Object object)
     Searches this Vector for the specified object.
public synchronized  booleancontainsAll(Collection collection)
     Searches this Vector for all objects in the specified Collection.
public synchronized  voidcopyInto(Object[] elements)
     Attempts to copy elements contained by this Vector into the corresponding elements of the supplied Object array.
public synchronized  EelementAt(int location)
     Answers the element at the specified location in this Vector.
public  Enumeration<E>elements()
     Answers an Enumeration on the elements of this Vector.
public synchronized  voidensureCapacity(int minimumCapacity)
     Ensures that this Vector can hold the specified number of elements without growing.
public synchronized  booleanequals(Object object)
     Compares the specified object to this Vector and answer if they are equal.
public synchronized  EfirstElement()
     Answers the first element in this Vector.
public  Eget(int location)
     Answers the element at the specified location in this Vector.
public synchronized  inthashCode()
     Answers an integer hash code for the receiver.
public  intindexOf(Object object)
     Searches in this Vector for the index of the specified object.
public synchronized  intindexOf(Object object, int location)
     Searches in this Vector for the index of the specified object.
public synchronized  voidinsertElementAt(E object, int location)
     Inserts the specified object into this Vector at the specified location. This object is inserted before any previous element at the specified location.
public synchronized  booleanisEmpty()
     Answers if this Vector has no elements, a size of zero.
public synchronized  ElastElement()
     Answers the last element in this Vector.
public synchronized  intlastIndexOf(Object object)
     Searches in this Vector for the index of the specified object.
public synchronized  intlastIndexOf(Object object, int location)
     Searches in this Vector for the index of the specified object.
public synchronized  Eremove(int location)
    
public  booleanremove(Object object)
     Removes the first occurrence, starting at the beginning and moving towards the end, of the specified object from this Vector.
public synchronized  booleanremoveAll(Collection collection)
     Removes all occurrences in this Vector of each object in the specified Collection.
public synchronized  voidremoveAllElements()
     Removes all elements from this Vector, leaving the size zero and the capacity unchanged.
public synchronized  booleanremoveElement(Object object)
     Removes the first occurrence, starting at the beginning and moving towards the end, of the specified object from this Vector.
public synchronized  voidremoveElementAt(int location)
     Removes the element found at index position location from this Vector and decrements the size accordingly.
protected  voidremoveRange(int start, int end)
     Removes the objects in the specified range from the start to the, but not including, end index.
public synchronized  booleanretainAll(Collection collection)
     Removes all objects from this Vector that are not contained in the specified Collection.
public synchronized  Eset(int location, E object)
     Replaces the element at the specified location in this Vector with the specified object.
public synchronized  voidsetElementAt(E object, int location)
     Replaces the element at the specified location in this Vector with the specified object.
public synchronized  voidsetSize(int length)
     Sets the size of this Vector to the specified size.
public synchronized  intsize()
     Answers the number of elements in this Vector.
public synchronized  List<E>subList(int start, int end)
     Answers a List of the specified portion of this Vector from the start index to one less than the end index.
public synchronized  Object[]toArray()
     Answers a new array containing all elements contained in this Vector.
public synchronized  T[]toArray(T[] contents)
     Answers an array containing all elements contained in this Vector.
public synchronized  StringtoString()
     Answers the string representation of this Vector.
public synchronized  voidtrimToSize()
     Sets the capacity of this Vector to be the same as the size.

Field Detail
capacityIncrement
protected int capacityIncrement(Code)
How many elements should be added to the vector when it is detected that it needs to grow to accommodate extra entries.



elementCount
protected int elementCount(Code)
The number of elements or the size of the vector.



elementData
protected Object[] elementData(Code)
The elements of the vector.




Constructor Detail
Vector
public Vector()(Code)
Constructs a new Vector using the default capacity.



Vector
public Vector(int capacity)(Code)
Constructs a new Vector using the specified capacity.
Parameters:
  capacity - the initial capacity of the new vector



Vector
public Vector(int capacity, int capacityIncrement)(Code)
Constructs a new Vector using the specified capacity and capacity increment.
Parameters:
  capacity - the initial capacity of the new Vector
Parameters:
  capacityIncrement - the amount to increase the capacity when this Vector is full



Vector
public Vector(Collection<? extends E> collection)(Code)
Constructs a new instance of Vector containing the elements in collection. The order of the elements in the new Vector is dependent on the iteration order of the seed collection.
Parameters:
  collection - the collection of elements to add




Method Detail
add
public void add(int location, E object)(Code)
Adds the specified object into this Vector at the specified location. The object is inserted before any previous element at the specified location. If the location is equal to the size of this Vector, the object is added at the end.
Parameters:
  location - the index at which to insert the element
Parameters:
  object - the object to insert in this Vector
exception:
  ArrayIndexOutOfBoundsException - when location < 0 || > size()
See Also:   Vector.addElement
See Also:   Vector.size



add
public synchronized boolean add(E object)(Code)
Adds the specified object at the end of this Vector.
Parameters:
  object - the object to add to the Vector true



addAll
public synchronized boolean addAll(int location, Collection<? extends E> collection)(Code)
Inserts the objects in the specified Collection at the specified location in this Vector. The objects are inserted in the order in which they are returned from the Collection iterator.
Parameters:
  location - the location to insert the objects
Parameters:
  collection - the Collection of objects true if this Vector is modified, false otherwise
exception:
  ArrayIndexOutOfBoundsException - when location < 0 orlocation > size()



addAll
public synchronized boolean addAll(Collection<? extends E> collection)(Code)
Adds the objects in the specified Collection to the end of this Vector.
Parameters:
  collection - the Collection of objects true if this Vector is modified, false otherwise



addElement
public synchronized void addElement(E object)(Code)
Adds the specified object at the end of this Vector.
Parameters:
  object - the object to add to the Vector



capacity
public synchronized int capacity()(Code)
Answers the number of elements this Vector can hold without growing. the capacity of this Vector
See Also:   Vector.ensureCapacity
See Also:   Vector.size



clear
public void clear()(Code)
Removes all elements from this Vector, leaving it empty.
See Also:   Vector.isEmpty
See Also:   Vector.size



clone
public synchronized Object clone()(Code)
Answers a new Vector with the same elements, size, capacity and capacity increment as this Vector. a shallow copy of this Vector
See Also:   java.lang.Cloneable



contains
public boolean contains(Object object)(Code)
Searches this Vector for the specified object.
Parameters:
  object - the object to look for in this Vector true if object is an element of this Vector, false otherwise
See Also:   Vector.indexOf(Object)
See Also:   Vector.indexOf(Object,int)
See Also:   java.lang.Object.equals



containsAll
public synchronized boolean containsAll(Collection collection)(Code)
Searches this Vector for all objects in the specified Collection.
Parameters:
  collection - the Collection of objects true if all objects in the specified Collection are elements ofthis Vector, false otherwise



copyInto
public synchronized void copyInto(Object[] elements)(Code)
Attempts to copy elements contained by this Vector into the corresponding elements of the supplied Object array.
Parameters:
  elements - the Object array into which the elements ofthis Vector are copied
See Also:   Vector.clone



elementAt
public synchronized E elementAt(int location)(Code)
Answers the element at the specified location in this Vector.
Parameters:
  location - the index of the element to return in this Vector the element at the specified location
exception:
  ArrayIndexOutOfBoundsException - when location < 0 || >= size()
See Also:   Vector.size



elements
public Enumeration<E> elements()(Code)
Answers an Enumeration on the elements of this Vector. The results of the Enumeration may be affected if the contents of this Vector are modified. an Enumeration of the elements of this Vector
See Also:   Vector.elementAt
See Also:   Enumeration



ensureCapacity
public synchronized void ensureCapacity(int minimumCapacity)(Code)
Ensures that this Vector can hold the specified number of elements without growing.
Parameters:
  minimumCapacity - the minimum number of elements that this vector will holdbefore growing
See Also:   Vector.capacity



equals
public synchronized boolean equals(Object object)(Code)
Compares the specified object to this Vector and answer if they are equal. The object must be a List which contains the same objects in the same order.
Parameters:
  object - the object to compare with this object true if the specified object is equal to this Vector, falseotherwise
See Also:   Vector.hashCode



firstElement
public synchronized E firstElement()(Code)
Answers the first element in this Vector. the element at the first position
exception:
  NoSuchElementException - when this vector is empty
See Also:   Vector.elementAt
See Also:   Vector.lastElement
See Also:   Vector.size



get
public E get(int location)(Code)
Answers the element at the specified location in this Vector.
Parameters:
  location - the index of the element to return in this Vector the element at the specified location
exception:
  ArrayIndexOutOfBoundsException - when location < 0 || >= size()
See Also:   Vector.size



hashCode
public synchronized int hashCode()(Code)
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method. the receiver's hash
See Also:   Vector.equals



indexOf
public int indexOf(Object object)(Code)
Searches in this Vector for the index of the specified object. The search for the object starts at the beginning and moves towards the end of this Vector.
Parameters:
  object - the object to find in this Vector the index in this Vector of the specified element, -1 if theelement isn't found
See Also:   Vector.contains
See Also:   Vector.lastIndexOf(Object)
See Also:   Vector.lastIndexOf(Object,int)



indexOf
public synchronized int indexOf(Object object, int location)(Code)
Searches in this Vector for the index of the specified object. The search for the object starts at the specified location and moves towards the end of this Vector.
Parameters:
  object - the object to find in this Vector
Parameters:
  location - the index at which to start searching the index in this Vector of the specified element, -1 if theelement isn't found
exception:
  ArrayIndexOutOfBoundsException - when location < 0
See Also:   Vector.contains
See Also:   Vector.lastIndexOf(Object)
See Also:   Vector.lastIndexOf(Object,int)



insertElementAt
public synchronized void insertElementAt(E object, int location)(Code)
Inserts the specified object into this Vector at the specified location. This object is inserted before any previous element at the specified location. If the location is equal to the size of this Vector, the object is added at the end.
Parameters:
  object - the object to insert in this Vector
Parameters:
  location - the index at which to insert the element
exception:
  ArrayIndexOutOfBoundsException - when location < 0 || > size()
See Also:   Vector.addElement
See Also:   Vector.size



isEmpty
public synchronized boolean isEmpty()(Code)
Answers if this Vector has no elements, a size of zero. true if this Vector has no elements, false otherwise
See Also:   Vector.size



lastElement
public synchronized E lastElement()(Code)
Answers the last element in this Vector. the element at the last position
exception:
  NoSuchElementException - when this vector is empty
See Also:   Vector.elementAt
See Also:   Vector.firstElement
See Also:   Vector.size



lastIndexOf
public synchronized int lastIndexOf(Object object)(Code)
Searches in this Vector for the index of the specified object. The search for the object starts at the end and moves towards the start of this Vector.
Parameters:
  object - the object to find in this Vector the index in this Vector of the specified element, -1 if theelement isn't found
See Also:   Vector.contains
See Also:   Vector.indexOf(Object)
See Also:   Vector.indexOf(Object,int)



lastIndexOf
public synchronized int lastIndexOf(Object object, int location)(Code)
Searches in this Vector for the index of the specified object. The search for the object starts at the specified location and moves towards the start of this Vector.
Parameters:
  object - the object to find in this Vector
Parameters:
  location - the index at which to start searching the index in this Vector of the specified element, -1 if theelement isn't found
exception:
  ArrayIndexOutOfBoundsException - when location >= size()
See Also:   Vector.contains
See Also:   Vector.indexOf(Object)
See Also:   Vector.indexOf(Object,int)



remove
public synchronized E remove(int location)(Code)



remove
public boolean remove(Object object)(Code)
Removes the first occurrence, starting at the beginning and moving towards the end, of the specified object from this Vector.
Parameters:
  object - the object to remove from this Vector true if the specified object was found, false otherwise
See Also:   Vector.removeAllElements
See Also:   Vector.removeElementAt
See Also:   Vector.size



removeAll
public synchronized boolean removeAll(Collection collection)(Code)
Removes all occurrences in this Vector of each object in the specified Collection.
Parameters:
  collection - the Collection of objects to remove true if this Vector is modified, false otherwise



removeAllElements
public synchronized void removeAllElements()(Code)
Removes all elements from this Vector, leaving the size zero and the capacity unchanged.
See Also:   Vector.isEmpty
See Also:   Vector.size



removeElement
public synchronized boolean removeElement(Object object)(Code)
Removes the first occurrence, starting at the beginning and moving towards the end, of the specified object from this Vector.
Parameters:
  object - the object to remove from this Vector true if the specified object was found, false otherwise
See Also:   Vector.removeAllElements
See Also:   Vector.removeElementAt
See Also:   Vector.size



removeElementAt
public synchronized void removeElementAt(int location)(Code)
Removes the element found at index position location from this Vector and decrements the size accordingly.
Parameters:
  location - the index of the element to remove
exception:
  ArrayIndexOutOfBoundsException - when location < 0 || >= size()
See Also:   Vector.removeElement
See Also:   Vector.removeAllElements
See Also:   Vector.size



removeRange
protected void removeRange(int start, int end)(Code)
Removes the objects in the specified range from the start to the, but not including, end index.
Parameters:
  start - the index at which to start removing
Parameters:
  end - the index one past the end of the range to remove
exception:
  IndexOutOfBoundsException - when start < 0, start > end orend > size()



retainAll
public synchronized boolean retainAll(Collection collection)(Code)
Removes all objects from this Vector that are not contained in the specified Collection.
Parameters:
  collection - the Collection of objects to retain true if this Vector is modified, false otherwise



set
public synchronized E set(int location, E object)(Code)
Replaces the element at the specified location in this Vector with the specified object.
Parameters:
  location - the index at which to put the specified object
Parameters:
  object - the object to add to this Vector the previous element at the location
exception:
  ArrayIndexOutOfBoundsException - when location < 0 || >= size()
See Also:   Vector.size



setElementAt
public synchronized void setElementAt(E object, int location)(Code)
Replaces the element at the specified location in this Vector with the specified object.
Parameters:
  object - the object to add to this Vector
Parameters:
  location - the index at which to put the specified object
exception:
  ArrayIndexOutOfBoundsException - when location < 0 || >= size()
See Also:   Vector.size



setSize
public synchronized void setSize(int length)(Code)
Sets the size of this Vector to the specified size. If there are more than length elements in this Vector, the elements at end are lost. If there are less than length elements in the Vector, the additional elements contain null.
Parameters:
  length - the new size of this Vector
See Also:   Vector.size



size
public synchronized int size()(Code)
Answers the number of elements in this Vector. the number of elements in this Vector
See Also:   Vector.elementCount
See Also:   Vector.lastElement



subList
public synchronized List<E> subList(int start, int end)(Code)
Answers a List of the specified portion of this Vector from the start index to one less than the end index. The returned List is backed by this Vector so changes to one are reflected by the other.
Parameters:
  start - the index at which to start the sublist
Parameters:
  end - the index one past the end of the sublist a List of a portion of this Vector
exception:
  IndexOutOfBoundsException - when start < 0 or end > size()
exception:
  IllegalArgumentException - when start > end



toArray
public synchronized Object[] toArray()(Code)
Answers a new array containing all elements contained in this Vector. an array of the elements from this Vector



toArray
public synchronized T[] toArray(T[] contents)(Code)
Answers an array containing all elements contained in this Vector. If the specified array is large enough to hold the elements, the specified array is used, otherwise an array of the same type is created. If the specified array is used and is larger than this Vector, the array element following the collection elements is set to null.
Parameters:
  contents - the array an array of the elements from this Vector
exception:
  ArrayStoreException - when the type of an element in this Vector cannot bestored in the type of the specified array



toString
public synchronized String toString()(Code)
Answers the string representation of this Vector. the string representation of this Vector
See Also:   Vector.elements



trimToSize
public synchronized void trimToSize()(Code)
Sets the capacity of this Vector to be the same as the size.
See Also:   Vector.capacity
See Also:   Vector.ensureCapacity
See Also:   Vector.size



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