Java ArrayList Create newArrayListOnNull(List list)

Here you can find the source of newArrayListOnNull(List list)

Description

new Array List On Null

License

Apache License

Declaration

public static <T> List<T> newArrayListOnNull(List<T> list) 

Method Source Code


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

import java.util.*;

public class Main {
    public static <T> List<T> newArrayListOnNull(List<T> list) {
        if (list == null) {
            list = new ArrayList<T>();
        }/* w w  w  .  j  a v  a2 s.  c  o  m*/
        return list;
    }
}

Related

  1. newArrayList(T... elements)
  2. newArrayList(T... items)
  3. newArrayList(T... objectList)
  4. newArrayList(T... objs)
  5. newArrayList(X... args)
  6. newArrayListSized(Iterable fromSize)
  7. newArrayListWithCapacity(int initSize)
  8. newArrayOfEmptyArrayList(int len)
  9. sizedArrayList(final int size)