Create unmodifiable List from Array - Java java.util

Java examples for java.util:List Creation

Description

Create unmodifiable List from Array

Demo Code


//package com.java2s;
import java.util.Arrays;

import java.util.Collections;

import java.util.List;

public class Main {
    public static <T> List<T> listOf(final T... items) {
        return Collections.unmodifiableList(Arrays.asList(items));
    }/*  w w w  .  j a v  a  2  s.c o m*/
}

Related Tutorials