Replace All Elements Of Java Vector : Vector « Collections Data Structure « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » Collections Data Structure » Vector 




Replace All Elements Of Java Vector
  

import java.util.Collections;
import java.util.Vector;

public class Main {
  public static void main(String[] args) {
    Vector<String> v = new Vector<String>();

    v.add("A");
    v.add("B");
    v.add("D");

    System.out.println(v);
    Collections.fill(v, "REPLACED");
    System.out.println(v);
  }
}
/*
[A, B, D]
[REPLACED, REPLACED, REPLACED]
*/

   
    
  














Related examples in the same category
1.Use Vector in java.utilUse Vector in java.util
2.Finding elements in a vectorFinding elements in a vector
3.Serializing a vectorSerializing a vector
4.Save Vector to file
5.Create Vector test
6.Find Vector Find Vector
7.Remove Element in Vector
8.Sequence Sequence
9.Vector Util
10.Iterator out of Vector
11.Copy Elements of One Java Vector to Another Java Vector
12.Copy Elements of Vector to Java ArrayList
13.Create Java ArrayList From Enumeration
14.Find maximum element of Java Vector
15.Find Minimum element of Java Vector
16.Get Enumeration over Java Vector
17.Perform Binary Search on Java Vector
18.Replace all occurrences of specified element of Java Vector
19.Reverse order of all elements of Java Vector
20.Shuffle elements of Java Vector
21.Swap elements of Java Vector
22.Sort Java Vector in descending order using comparator
23.Enumerate through a Vector using Java Enumeration
24.Append all elements of other Collection to Java Vector
25.Copy all elements of Java Vector to an Object Array
26.Get Size of Java Vector and loop through the elements
27.Get Sub List of Java Vector Example
28.Insert all elements of other Collection to Specified Index of Java Vector
29.Iterate through elements Java Vector using Iterator
30.Iterate through elements Java Vector using ListIterator
31.Remove all elements from Java Vector
32.Remove an element from specified index of Java Vector
33.Remove specified element from Java Vector
34.Replace an element at specified index of Java Vector
35.Search an element of Java Vector
36.Search an element of Java Vector from specific index
37.Set size of Java Vector Example
38.Sort elements of Java Vector
39.Generic Vector with String
40.Count distinct elements in a Vector
41.Unmodifiable Vector Adapter
42.Adaptive extension of the java.util.Vector class
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.