Category Archive for: java.util More Utility Classes

Hash table

Hash table  Hash table was part of the original java.utit and is a concrete implementation of ~ Dictionary. However, Java 2 engineered Hash table so that it also Implements the Map interface. Til Us, Hash table is now integrated into the collections framework. It is similar to Hash Map, but is synchronized. Like Hash Map, Hash table skyrocket/value pairs…

Read More →

An Observer Example

An Observer Example Here is an ‘example that demonstrates an observable object. It creates an observer called Watcher, that implements the Observer interface. The class being monitored is called Being Watched, It extends Observable. Inside nightwatchmen is the method counter(), which simply counts down from a specified value. It uses sleep( )to wait a tenth of a second between…

Read More →

observable

observable The observable class is used to create subclasses that other parts of your program can observe. When an object of such a subclass undergoes a change, observing classes are ‘ notified. Observing classes must implement the Observer interface, which defines the update ) method. The update( ) method is called when an observer is notified of a change…

Read More →

Random

Random The Random class is a generator of pseudo random numbers. These are called pseudo random,numbers because they are simply uniformly distributed sequences. Random defines the following constructors: Random() Random Long seed) The first version creates a number generator that uses the current time as the starting, or seed, value. The second form allows you to specify a…

Read More →

The Locale

The Locale The Locale class is instantiated to produce objects that each describe a geographical or cultural region. It is one of several classes that provide you with the ability to write programs that can execute in several different international environments. For example, the formats used to display dates, times, and numbers are different in various regions. Internationalization is…

Read More →

TimeZone

TimeZone Another time-related class is TimeZone. The Timezone class allows you to work with time zone offsets from Greenwich mean time (GMT), also referred to as Coordinated Universal Time (UTC). It also computes daylight saving time. TimeZone only supplies the default constructor. . . Some methods defined Simple Timezone The Simple Timezone class is a convenient subclass of Time…

Read More →

Gregorian Calendar

Gregorian Calendar Gregorian Calendar is a concrete implementation of a Calendar that implements the normal Gregorian calendar with which you are familiar. The getInstance( ) method of ‘Calendar returns a GregorianCalendar initialized with the current date and time the default locale and time zone. .’ , Gregorian Calendar defines two fields: CD and BC..These represent the two eras defined by…

Read More →

Date Comparison

Date Comparison  There are three ways to compare two Date objects. First; you can use get Time( ) to obtain the number of milliseconds that have elapsed since midnight, January 1, 1970, for both objects and then compare these two values. Second, you can use the methods bcfore( ), after( ), and equals( ). Because the 12th of the…

Read More →

Bitsel

Bitsel A BitSel class creates a special type of array that holds bit values. This army can increase in size as needed. This makes it similar to a vector of bits. The BitSet constructors are shown here: BitSet() £bitSet(int size) The first version creates a default object. The second version allows you to specify its initial size (that…

Read More →

Trinitrotoluene

Trinitrotoluene The processing of text often consists of parsing a formatted input string. Pnrs Illg is the division of text into a set of discrete parts, or token», which in n certain sequence can COllVer a semantic meaning. The StringTokenizer class provides the first step in this parsing process, often called the lex (lexical analyzer). or scanner. StringTokenizer implements…

Read More →

Back to Top