create List and add item - Android java.util

Android examples for java.util:List Element

Description

create List and add item

Demo Code


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

public class Main {
    public static List createList(Object item) {
        LinkedList list = new LinkedList();
        list.add(item);/*ww  w  .j  a  va2 s.c  om*/
        return list;
    }

    public static List createList(Object[] items) {
        LinkedList list = new LinkedList(Arrays.asList(items));
        return list;
    }
}

Related Tutorials