Example usage for java.util ArrayList add

List of usage examples for java.util ArrayList add

Introduction

In this page you can find the example usage for java.util ArrayList add.

Prototype

public boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this list.

Usage

From source file:net.reichholf.dreamdroid.helpers.enigma2.Movie.java

public static ArrayList<NameValuePair> getDeleteParams(ExtendedHashMap movie) {
    ArrayList<NameValuePair> params = new ArrayList<>();
    params.add(new BasicNameValuePair("sRef", movie.getString(Movie.KEY_REFERENCE)));

    return params;
}

From source file:Main.java

public static Collection enumToCollection(Enumeration e) {
    ArrayList result = new ArrayList();
    while (e.hasMoreElements()) {
        result.add(e.nextElement());
    }/*w  w  w .j  a va 2 s.  com*/
    return result;
}

From source file:com.moscona.dataSpace.debug.ByteBufferTest.java

public static void print(String label, ByteBuffer buf) {
    System.out.println(label + ":");
    ArrayList<String> l = new ArrayList<String>();
    for (byte b : buf.array()) {
        l.add(Byte.toString(b));
    }/*ww w.j  a v a2s .  c om*/
    System.out.println("  " + StringUtils.join(l, ", "));
}

From source file:Main.java

public static <T> ArrayList<T> alistInit(T value, int size) {
    ArrayList<T> ret = new ArrayList<T>(size);
    for (int i = 0; i < size; i++)
        ret.add(value);
    return ret;/*from w ww.  ja  v a  2 s .co m*/
}

From source file:Main.java

public static <T> ArrayList<T> ArrayToList(T[] datas) {
    ArrayList<T> array = new ArrayList<>(datas.length);
    for (T t : datas) {
        array.add(t);
    }/*www  .j a  v  a 2  s  .  c o m*/
    return array;
}

From source file:Main.java

public static <T> List<T> asList(T e0, T e1) {
    ArrayList<T> result = new ArrayList<>(2);
    result.add(e0);
    result.add(e1);/*from   w w w .  j  ava2 s. co m*/
    return result;
}

From source file:Main.java

public static <T> List<T> asList(T e0, T e1, T e2) {
    ArrayList<T> result = new ArrayList<>(3);
    result.add(e0);
    result.add(e1);/*from   w  ww . j a  v a  2s.c o  m*/
    result.add(e2);
    return result;
}

From source file:Main.java

public static Intent newSendMultipleAttachmentsIntent(String emailAddress, String subject, String contentBody,
        ArrayList<Uri> uris) {

    final Intent ei = new Intent(Intent.ACTION_SEND_MULTIPLE);
    ei.setType("plain/text");
    ei.putExtra(Intent.EXTRA_EMAIL, new String[] { emailAddress });
    ei.putExtra(Intent.EXTRA_SUBJECT, subject);

    //ei.putExtra(Intent.EXTRA_TEXT, contentBody);
    //fix for ClassCastException with Intent.EXTRA_TEXT : https://code.google.com/p/android/issues/detail?id=38303
    //: use list of string not a string
    ArrayList<String> extra_text = new ArrayList<String>();
    extra_text.add(contentBody);
    ei.putExtra(Intent.EXTRA_TEXT, extra_text);

    ei.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

    return ei;//  ww w  .ja  v  a 2 s .  c  o m
}

From source file:Main.java

/**
 * Convert the given array into an ArrayList.
 * @param array//ww  w .ja v  a2s . co m
 * @param <T>
 * @return
 */
public static <T> ArrayList<T> toArrayList(T[] array) {
    ArrayList<T> al = new ArrayList<T>();

    for (T item : array) {
        al.add(item);
    }

    return al;
}

From source file:Main.java

/**
 * @author TheMrMilchmann//from w w w.j a  va 2  s .co  m
 * @since DerpieLang v1.0.0
 */
@SafeVarargs
public static final <T> ArrayList<T> asArrayList(T... objects) {
    ArrayList<T> list = new ArrayList<T>();

    for (T object : objects)
        list.add(object);

    return list;
}