db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta Satoor" <msat...@gmail.com>
Subject Question about next() and previous() on CollationElementIterator.
Date Mon, 10 Sep 2007 19:57:19 GMT

I have a very simple program(included at the bottom of the mail) which uses
the CollationElementIterator to do some very basic next/previous method
calls through the iterator. When I run the program, it is not behaving as
per the JDBC API documentation at
The JDBC API for next and previous very specifically say that "call next()
and then call previous(), or call previous() and then call next()), you'll
get back the same element twice." But when I execute the following program
with Sun's jdk 1.5 on command line, I get following output
next is 2147418112
previous is -97714176

I had expected the output to be
next is 2147418112
previous is 2147418112

Am I doing something wrong here or not interpreting the documentation
correctly? Any help will be greatly appreciated. As a side note, when I run
the same program through the Eclipse debugger, I get the expected behavior
which is that next and previous both return the same value.


import java.text.Collator;
import java.text.RuleBasedCollator;
import java.util.Locale;
import java.text.CollationElementIterator;

public class simpleTest {
 public static String aa = "\uFA2D";

 public static void main(String[] args) throws Exception {
  RuleBasedCollator myCollator = (RuleBasedCollator)Collator.getInstance(new
  CollationElementIterator anIterator =
  System.out.println("next is " + anIterator.next());
  System.out.println("previous is " + anIterator.previous());

View raw message