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

Static Public Member Functions

static< K > HashSet< K > newHashSet ()
 
static< E > HashSet< E > newHashSet (E... elements)
 
static< E > SortedSet< E > newSortedSet (E... elements)
 

Detailed Description

Provides static methods for creating mutable

Set

instances easily and other static methods for working with Sets.

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 23 of file Sets.java.

Member Function Documentation

◆ newHashSet() [1/2]

static <K> HashSet<K> com.google.appinventor.components.runtime.collect.Sets.newHashSet ( )
static

Creates an empty

HashSet

instance.

Note: if

E

is an Enum type, use {} instead. Note: if you only need an immutable empty Set, use Collections#emptySet instead.

Returns
a newly-created, initially-empty
HashSet

Definition at line 36 of file Sets.java.

◆ newHashSet() [2/2]

static <E> HashSet<E> com.google.appinventor.components.runtime.collect.Sets.newHashSet ( E...  elements)
static

Creates a

HashSet

instance containing the given elements.

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

Set<Base> set = Sets.newHashSet(sub1, sub2);

where

sub1

and

sub2

are references to subtypes of

Base

, not of

Base

itself. To get around this, you must use:

Set<Base> set = Sets.<Base>newHashSet(sub1, sub2);
Parameters
elementsthe elements that the set should contain
Returns
a newly-created
HashSet
containing those elements (minus duplicates)

Definition at line 57 of file Sets.java.

◆ newSortedSet()

static <E> SortedSet<E> com.google.appinventor.components.runtime.collect.Sets.newSortedSet ( E...  elements)
static

Creates a

SortedSet

instance containing the given elements.

Parameters
elementsthe elements that the set should contain
Returns
a newly-created
SortedSet
containing those elements (minus duplicates)

Definition at line 71 of file Sets.java.


The documentation for this class was generated from the following file:
com.google.appinventor.components.runtime.collect.Sets.newHashSet
static< K > HashSet< K > newHashSet()
Definition: Sets.java:36