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:org.apache.karaf.docker.api.DockerFactory.java

public static Docker createInstance(String address) {
    ArrayList providers = new ArrayList();
    providers.add(new JacksonJsonProvider());
    return JAXRSClientFactory.create(address, Docker.class, providers);
}

From source file:Main.java

public static <T> ArrayList<T> createArrayList(T t) {
    final ArrayList<T> result = new ArrayList<T>();

    result.add(t);

    return result;
}

From source file:Main.java

/**
 * Returns a modifiable list containing just the specified element.
 *
 * @param value  The value to be wrapped in a list
 * @param <T>  The type of the value
 *
 * @return  The value wrapped in a modifiable list
 *//*from  w  w  w  . java 2 s  .c  om*/
public static <T> List<T> toList(T value) {
    ArrayList<T> newList = new ArrayList<>();
    newList.add(value);
    return newList;
}

From source file:Main.java

public static Collection<?> asCollection(Object o) {
    if (o instanceof Collection) {
        return (Collection<?>) o;
    } else {//from w  ww.j  av a 2s  . co  m
        ArrayList<Object> list = new ArrayList<Object>();
        list.add(o);
        return list;
    }
}

From source file:Main.java

public static boolean hasImageCaptureBug() {

    // list of known devices that have the bug
    ArrayList<String> devices = new ArrayList<String>();
    devices.add("android-devphone1/dream_devphone/dream");
    devices.add("generic/sdk/generic");
    devices.add("vodafone/vfpioneer/sapphire");
    devices.add("tmobile/kila/dream");
    devices.add("verizon/voles/sholes");
    devices.add("google_ion/google_ion/sapphire");

    return devices
            .contains(android.os.Build.BRAND + "/" + android.os.Build.PRODUCT + "/" + android.os.Build.DEVICE);

}

From source file:Main.java

public static <T> List<T> list(T... ts) {
    ArrayList<T> list = new ArrayList<T>();
    for (T t : ts) {
        list.add(t);
    }//w w w.j a v a 2  s.  com

    return list;
}

From source file:Main.java

private static ArrayList<?> makeSerializableList(List<?> list) {
    ArrayList arr = new ArrayList();
    for (Object way : list) {
        arr.add(way);
    }//from   w  ww .  j  ava2 s . c o  m
    return arr;
}

From source file:Main.java

private static <T> T[] prependTo(T outerInstance, T[] params) {
    ArrayList<T> paramsList = new ArrayList<>(params.length + 1);

    paramsList.add(outerInstance);
    for (T param : params) {
        paramsList.add(param);/*from   ww  w  . ja va2 s .  co m*/
    }
    return paramsList.toArray(params);
}

From source file:Main.java

public static final <T> List<T> setToArrayList(Set<T> set) {
    ArrayList<T> list = new ArrayList<T>();
    for (T t : set) {
        list.add(t);
    }//w  w  w . j av a 2 s.com
    return list;
}

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

public static ArrayList<NameValuePair> getStateParams(String state) {
    ArrayList<NameValuePair> params = new ArrayList<>();
    params.add(new BasicNameValuePair("newstate", state));

    return params;
}