Java Array to List toList(final T[] array)

Here you can find the source of toList(final T[] array)

Description

to List

License

Open Source License

Declaration

public static <T> List<T> toList(final T[] array) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Main {
    public static <T> List<T> toList(final T[] array) {
        if (array == null) {
            return Collections.emptyList();
        } else {// ww  w. ja va2 s .c o  m
            return Collections.unmodifiableList(Arrays.asList(array));
        }
    }
}

Related

  1. toList(final int[] array)
  2. ToList(final Object[] array)
  3. toList(final Object[] objects)
  4. toList(final T... objects)
  5. toList(final T[] array)
  6. toList(final T[] array)
  7. toList(final T[] array)
  8. toList(final T[] array)
  9. toList(int[] a)