net.rim.device.api.collection
Interface ReadableSet

All Superinterfaces:
Collection
All Known Implementing Classes:
LongHashtableCollection, AutoText

public interface ReadableSet
extends Collection

Provides read access to a set-type collection.


Method Summary
 boolean contains(Object element)
          Determines if this collection contains an element.
 Enumeration getElements()
          Retrieves an enumeration of this collection's elements.
 int getElements(Object[] elements)
          Retrieves this collection's elements.
 int size()
          Retrieves the number of elements in this collection.
 

Method Detail

size

public int size()
Retrieves the number of elements in this collection.

Returns:
Number of elements in this collection.

contains

public boolean contains(Object element)
Determines if this collection contains an element.

Parameters:
element - Element to look for.
Returns:
True if this collection contains the element; otherwise, false.
Since:
JDE 4.0.2

getElements

public Enumeration getElements()
Retrieves an enumeration of this collection's elements.

Returns:
Enumeration of this collection's elements.

getElements

public int getElements(Object[] elements)
Retrieves this collection's elements.

The array you provide to contain the collection's elements must be large enough to contain them. Accordingly, you should synchronize on this collection, invoke size(), create an array of the required size, and then invoke this method. This ensures that the collection's size won't change by the time you get to actually retrieving its elements.

This method also completely erases the current contents of your object array out-parameter.

Parameters:
elements - Object array to contain returned elements; must be large enough to retrieve the collection's elements.
Returns:
Number of elements actually retrieved.
Since:
JDE 4.0.2


Copyright 1999-2004 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.