home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
jbuilder
/
jsamples.z
/
Counting1.java
< prev
next >
Wrap
Text File
|
1997-07-30
|
568b
|
26 lines
// Copyright(c) 1997 ObjectSpace, Inc.
import COM.objectspace.jgl.*;
/**
* Sum the values of a range.
*
* @see COM.objectspace.jgl.Counting
* @version 2.0.2
* @author ObjectSpace, Inc.
*/
public class Counting1
{
public static void main( String[] args )
{
int intArray[] = { 1, 2, 3, 4, 5 };
IntIterator begin = IntIterator.begin( intArray );
IntIterator end = IntIterator.end( intArray );
Number sum = Counting.accumulate( begin, end, new Integer( 0 ) );
System.out.println( "Sum = " + sum );
}
}