Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        // create vector object 
        List<String> vector = new ArrayList<String>();

        // populate the vector
        vector.add("1");
        vector.add("2");
        vector.add("3");
        vector.add("4");
        vector.add("from java2s.com");

        // create a synchronized view
        Collection<String> c = Collections.synchronizedCollection(vector);

        System.out.println("Sunchronized view is :" + c);
    }
}