Create new Copy On Write Array List - Java java.util

Java examples for java.util:List Creation

Description

Create new Copy On Write Array List

Demo Code


//package com.java2s;

import java.util.Collection;

import java.util.concurrent.CopyOnWriteArrayList;

public class Main {
    public static void main(String[] argv) {
        System.out.println(newCopyOnWriteArrayList());
    }//  w  w w  .  j a  v a 2  s.co m

    public static <E> CopyOnWriteArrayList<E> newCopyOnWriteArrayList() {
        return new CopyOnWriteArrayList<E>();
    }

    public static <E> CopyOnWriteArrayList<E> newCopyOnWriteArrayList(
            final Collection<? extends E> c) {
        return new CopyOnWriteArrayList<E>(c);
    }

    public static <E> CopyOnWriteArrayList<E> newCopyOnWriteArrayList(
            final E[] toCopyIn) {
        return new CopyOnWriteArrayList<E>(toCopyIn);
    }
}

Related Tutorials