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

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

Description

add

License

Apache License

Declaration

static <T> List<T> add(List<T> list, T element) 

Method Source Code


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

import java.util.ArrayList;

import java.util.List;

public class Main {
    static <T> List<T> add(List<T> list, T element) {
        final ArrayList<T> result = new ArrayList<T>(list.size() + 2);
        result.addAll(list);/*from ww  w .j a v a2s.  c om*/
        result.add(element);
        return result;
    }
}

Related

  1. add(List list, String value)
  2. add(List aList, T anObj)
  3. add(List aList, T anObject)
  4. add(List current, T toAdd)
  5. add(List list, int i, T v)
  6. add(Map> multiValueMap, String key, Object value)
  7. add(Object o, List oldList)
  8. addElement(T element, List list)
  9. addElementIfAbsent(List l, T element)