AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.collect.Lists Class Reference

Static Public Member Functions

static< E > ArrayList< E > newArrayList ()
 
static< E > ArrayList< E > newArrayList (E... elements)
 

Detailed Description

Provides static methods for creating

List

instances easily, and other utility methods for working with lists.

Note: This was copied from the com.google.android.collect.Lists class

Author
markf.nosp@m.@goo.nosp@m.gle.c.nosp@m.om (Mark Friedman)

Definition at line 20 of file Lists.java.

Member Function Documentation

◆ newArrayList() [1/2]

static <E> ArrayList<E> com.google.appinventor.components.runtime.collect.Lists.newArrayList ( )
static

Creates an empty

ArrayList

instance.

Note: if you only need an immutable empty List, use Collections#emptyList instead.

Returns
a newly-created, initially-empty
ArrayList

Definition at line 30 of file Lists.java.

◆ newArrayList() [2/2]

static <E> ArrayList<E> com.google.appinventor.components.runtime.collect.Lists.newArrayList ( E...  elements)
static

Creates a resizable

ArrayList

instance containing the given elements.

Note: due to a bug in javac 1.5.0_06, we cannot support the following:

List<Base> list = Lists.newArrayList(sub1, sub2);

where

sub1

and

sub2

are references to subtypes of

Base

, not of

Base

itself. To get around this, you must use:

List<Base> list = Lists.<Base>newArrayList(sub1, sub2);
Parameters
elementsthe elements that the list should contain, in order
Returns
a newly-created
ArrayList
containing those elements

Definition at line 52 of file Lists.java.


The documentation for this class was generated from the following file:
com.google.appinventor.components.runtime.collect.Lists.newArrayList
static< E > ArrayList< E > newArrayList()
Definition: Lists.java:30