Java List Value Add add(List list, E element)

Here you can find the source of add(List list, E element)

Description

add

License

Apache License

Declaration

public static <E> List<E> add(List<E> list, E element) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static <E> List<E> add(List<E> list, E element) {
        if (element != null) {
            List<E> newList = new ArrayList<E>();
            if (list != null) {
                newList.addAll(list);/*from   w ww  .ja va 2s. c o  m*/
            }
            newList.add(element);
            return newList;
        }
        return list;
    }
}

Related

  1. add(final List toList, final List fromList)
  2. add(List list, int index, Object element)
  3. add(List valList, Object src)
  4. add(List list, E element)
  5. add(List result, ClassLoader loader)
  6. add(List list, int index, T item)
  7. add(List list, int index, T item)
  8. add(List vector, int[] sparseVector)
  9. add(List list, Object[] array)

    HOME | Copyright © www.java2s.com 2016