ColdFusion MX Professional Projects

Team-Fly

MIDP includes only a dozen classes from J2SE's java.util package. Many of the missing classes are part of the Collections API, which is too bulky for small devices. Table 4-3 lists the classes and interfaces of java.util in both J2SE and CLDC/MIDP.

Table 4-3: The java.util Package

INTERFACES

 

J2SE

MIDP

Collection

-

Comparator

-

Enumeration

Enumeration

EventListener

-

Iterator

-

List

-

ListIterator

-

Map

-

Map.Entry

-

Observer

-

Set

-

SortedMap

-

SortedSet

-

CLASSES

 

J2SE

MIDP

AbstractCollection

-

AbstractList

-

AbstractMap

-

AbstractSequentialList

-

AbstractSet

-

ArrayList

-

Arrays

-

BitSet

-

Enumeration

Enumeration

Collections

-

Date

Date

Dictionary

-

EventObject

-

GregorianCalendar

-

HashMap

-

HashSet

-

Hashtable

Hashtable

LinkedList

-

ListResourceBundle

-

Locale

-

Observable

-

Properties

-

PropertyPermission

-

PropertyResourceBundle

-

Random

Random

ResourceBundle

-

SimpleTimeZone

-

Stack

Stack

StringTokenizer

-

Timer

Timer

TimerTask

TimerTask

TimeZone

TimeZone

TreeMap

-

TreeSet

-

Vector

Vector

WeakHashMap

-

Collections

Although the full J2SE Collections API is not supported by MIDP, the old familiar Vector and Hashtable classes remain, as well as the lesser-known Stack. If you are familiar with the JDK 1.0 Vector and Hashtable classes, you should have no trouble with them in MIDP.

Timers

MIDP includes the Timer and TimerTask classes that were introduced into J2SE in the 1.3 version of the SDK. This is one of the few examples of J2SE classes that are not included in the CLDC but are included in MIDP.

Timer's API is identical to the J2SE version with one exception. The constructor that specifies whether the thread is a daemon is missing, as daemon threads are not supported in MIDP. The TimerTask API is exactly the same in J2SE SDK 1.3 and MIDP.

Telling Time

J2SE has an impressive array of classes that can be used for specifying dates and times and translating to and from human-readable representations of dates and times. The J2SE time classes have four distinct responsibilities:

Understanding these classes and their interactions is a little tricky, and it's complicated by the fact that it changed considerably between JDK 1.0 and JDK 1.1. The java.util.Date class used to have extra functionality in it; although the methods are deprecated, they're still present and may be confusing. Fortunately, you don't have to deal with this in the CLDC/MIDP world.

The situation is somewhat simpler in CLDC/MIDP. There are fewer classes, for one thing, and the Date class API has been cleaned up. In MIDP, the four responsibilities we just discussed are assigned to classes as follows:


Team-Fly

Категории