View Single Post
  #6 (permalink)  
Old 04-18-2008, 08:42 AM
Eranga's Avatar
Eranga Eranga is offline
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,338
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
A simple way I used to test this. See you can get the logic for your application.

Code:
public static void main(String[] args) { // TODO code application logic here ArrayList list1 = new ArrayList(); list1.add("a1"); list1.add("a2"); list1.add("a3"); ArrayList list2 = new ArrayList(); list2.add("b1"); list2.add("a2"); list2.add("a3"); for (int i = 0; i < list1.size(); i++){ String str1 = (String) list1.get(i); for (int j = 0; j < list2.size(); j++){ String str2 = (String) list2.get(j); int result = str1.compareTo(str2); if (result == 0) System.out.println(str1+ " = " + str2); else if (result > 0) System.out.println(str1+ " > " + str2); else if (result < 0) System.out.println(str1+ " < " + str2); } } }
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote