Function Java Vector class

457 views
344 views

Published on

Vector class

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
457
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
69
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Function Java Vector class

  1. 1. Vector Class Vector Vector [] ( Vector java.util Vector Comparable Vector Collections.sort() Collections java.util
  2. 2. Vector Class Reference:: Java::Vector Class new Vector() object vector new Vector( int_length ) object vector new Vector( length, size_increment ) object vector setSize() vector addElement() vector add() vector
  3. 3. Vector Class Reference:: Java::Vector Class setElementAt() vector removeElementAt() vector removeElement() vector removeAllElements() vector firstElement() element lastElement() element vector get() element vector
  4. 4. Vector Class Reference:: Java::Vector Class elementAt() element vector remove() element vector clear() vector capacity() vector size() vector isEmpty() indexOf() vector vector
  5. 5. Vector Class Back Reference :: Java :: Vector Class :: new Vector() Method new Vector (); return type Vector Content object vector example Vector vector = new Vector ();
  6. 6. Vector Class Back
  7. 7. Vector Class Back Reference :: Java :: Vector Class :: new Vector( int_length ) Method new Vector ( length ); return type Vector Content example object vector Vector vector = new Vector ( 20 );
  8. 8. Vector Class Back
  9. 9. Vector Class Back Reference :: Java :: Vector Class ::new Vector( length,size_increment) Method new Vector ( length, size_increment ); return type Vector Content example object vector Vector vector = new Vector ( 20, 10 );
  10. 10. Vector Class Back
  11. 11. Vector Class Back Reference :: Java :: Vector Class ::setSize() Method setSize ( length ); return type void Content example vector Vector vector = new Vector ( 20, 10 ); vector.setSize ( 30 );
  12. 12. Vector Class Back
  13. 13. Vector Class Back Reference :: Java :: Vector Class :: addElement() Method addElement ( object_string ); return type void Content example vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "labcode" );
  14. 14. Vector Class Back
  15. 15. Vector Class Back Reference :: Java :: Vector Class :: add() Method add ( index, object_string ); return type void Content example vector Vector vector = new Vector (); vector.addElement ( "labcode" ); vector.add ( 0, "bamboo" );
  16. 16. Vector Class Back
  17. 17. Vector Class Back Reference :: Java :: Vector Class :: insertElementAt() Method insertElementAt ( object_string, index ); return type void Content example vector Vector vector = new Vector (); vector.addElement ( "labcode" ); vector.insertElementAt ( "bamboo", 0 );
  18. 18. Vector Class Back
  19. 19. Vector Class Back Reference :: Java :: Vector Class :: setElementAt() Method setElementAt ( object_string, index ); return type void Content vector example Vector vector = new Vector (); vector.addElement ( "bambooss" ); vector.addElement ( "labcode" ); vector.setElementAt ( "bamboo", 0 );
  20. 20. Vector Class Back
  21. 21. Vector Class Back Reference :: Java :: Vector Class :: removeElementAt() Method removeElementAt ( index ); return type void Content vector example Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); vector.removeElementAt ( 1 );
  22. 22. Vector Class Back
  23. 23. Vector Class Back Reference :: Java :: Vector Class :: removeElement() Method removeElement ( object_string ); return type void Content example vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); vector.removeElement ( "lab" );
  24. 24. Vector Class Back
  25. 25. Vector Class Back Reference :: Java :: Vector Class :: removeAllElements () Method removeAllElements (); return type void Content example vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); vector.removeAllElements ();
  26. 26. Vector Class Back
  27. 27. Vector Class Back Reference :: Java :: Vector Class :: firstElement() Method firstElement (); return type Object Content example element vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); String str = ( String ) vector.firstElement ();
  28. 28. Vector Class Back
  29. 29. Vector Class Back Reference :: Java :: Vector Class :: lastElement() Method lastElement (); return type Object Content example element vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); String str = ( String ) vector.lastElement();
  30. 30. Vector Class Back
  31. 31. Vector Class Back Reference :: Java :: Vector Class :: get() Method get ( index ); return type Object Content example element vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); String str = ( String ) vector.get ( 1 );
  32. 32. Vector Class Back Reference :: Java :: Vector Class :: get() Method get ( index ); return type Object Content example element vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); String str = ( String ) vector.get ( 1 );
  33. 33. Vector Class Back
  34. 34. Vector Class Back Reference :: Java :: Vector Class :: elementAt() Method elementAt ( index ); return type Object Content example element vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); String str = ( String ) vector.elementAt ( 1 );
  35. 35. Vector Class Back
  36. 36. Vector Class Back Reference :: Java :: Vector Class :: remove() Method remove ( index ); return type Object Content element vector example Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); String str = ( String ) vector.remove ( 1 );
  37. 37. Vector Class Back
  38. 38. Vector Class Back Reference :: Java :: Vector Class :: clear() Method clear (); return type void Content example vector Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); vector.clear ();
  39. 39. Vector Class Back
  40. 40. Vector Class Back Reference :: Java :: Vector Class :: capacity() Method capacity() return type int Content vector example Vector vector = new Vector ( 20 ); int num_size = vector.capacity ();
  41. 41. Vector Class Back
  42. 42. Vector Class Back Reference :: Java :: Vector Class :: size() Method size (); return type int Content vector example Vector vector = new Vector ( 20 ); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); int num_size = vector.size ();
  43. 43. Vector Class Back
  44. 44. Vector Class Back Reference :: Java :: Vector Class :: isEmpty() Method isEmpty (); return type boolean Content vector example Vector vector = new Vector ( 20 ); if ( vector.isEmpty () ) { System.out.println ( "vector empty" ); }
  45. 45. Vector Class Back
  46. 46. Vector Class Back Reference :: Java :: Vector Class :: indexOf() Method indexOf ( object_string ); return type int Content example vector Vector vector = new Vector ( 20 ); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); int index_find = vector.indexOf("bamboo" );
  47. 47. Vector Class Back

×