home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
Collate3.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
1KB
|
44 lines
// Copyright(c) 1997 ObjectSpace, Inc.
import com.objectspace.jgl.*;
import com.objectspace.jgl.predicates.*;
import java.text.Collator;
/**
* Comparison using Collator objects.
*
* @see com.objectspace.jgl.predicates.LessCollator
* @see com.objectspace.jgl.predicates.LessEqualCollator
* @see com.objectspace.jgl.predicates.GreaterCollator
* @see com.objectspace.jgl.predicates.GreaterEqualCollator
* @see java.text.Collator
* @version 3.0.0
* @author ObjectSpace, Inc.
*/
public class Collate3
{
public static void show( String tag, BinaryPredicate predicate )
{
// create a set with given comparitor that allows duplicates
OrderedSet set = new OrderedSet( predicate, true );
// add a few entries
set.add( "Texas" );
set.add( "texas" );
set.add( "Texas Fight" );
// print the resulting container
System.out.println( tag + "\n\t" + set );
}
public static void main( String args[] )
{
show( "old style", new LessString() );
show( "default collating", new LessCollator() );
Collator collator = Collator.getInstance();
collator.setStrength( Collator.PRIMARY );
show( "case insensitive", new LessCollator( collator ) );
}
}