From b30ccc77d3a9822c6ffcebf9b45945822df200bc Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Mon, 18 May 2009 14:03:42 -0700 Subject: bug 252 - Freeze finalizers bug 2552 - Update Freeze for Java5 --- java/demo/Freeze/transform/Create.java | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'java/demo/Freeze/transform/Create.java') diff --git a/java/demo/Freeze/transform/Create.java b/java/demo/Freeze/transform/Create.java index 231730c52b4..d55f9301c4e 100644 --- a/java/demo/Freeze/transform/Create.java +++ b/java/demo/Freeze/transform/Create.java @@ -22,35 +22,32 @@ class Create extends Ice.Application } final String[] names = { "don", "ed", "frank", "gary", "arnold", "bob", "carlos" }; - final String[] phoneNumbers = { "(777)777-7777", "(666)666-6666", "(555)555-5555 x123", + final String[] phoneNumbers = { "(777)777-7777", "(666)666-6666", "(555)555-5555 x123", "(444)444-4444", "(333)333-3333 x1234", "(222)222-2222", "(111)111-1111" }; Connection connection = Util.createConnection(communicator(), "db"); - final java.util.Comparator less = - new java.util.Comparator() + final java.util.Comparator less = new java.util.Comparator() { - public int compare(Object o1, Object o2) + public int compare(String s1, String s2) { - if(o1 == o2) + if(s1 == s2) { return 0; } - else if(o1 == null) + else if(s1 == null) { - return -((Comparable)o2).compareTo(o1); + return -s2.compareTo(s1); } else { - return ((Comparable)o1).compareTo(o2); + return s1.compareTo(s2); } } }; - java.util.Map indexComparators = new java.util.HashMap(); - indexComparators.put("phoneNumber", less); + Contacts.IndexComparators indexComparators = new Contacts.IndexComparators(less); Contacts contacts = new Contacts(connection, "contacts", true, less, indexComparators); - // // Create a bunch of contacts within one transaction, and commit it @@ -73,7 +70,7 @@ class Create extends Ice.Application } System.out.println(names.length + " contacts were successfully created or updated"); - + return 0; } -- cgit v1.2.3