The Artima Developer Community
Sponsored Link

Java Answers Forum
TreeMaps

1 reply on 1 page. Most recent reply: Apr 2, 2003 8:30 PM by Dhrubo

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Alan smith

Posts: 1
Nickname: eddie404
Registered: Apr, 2003

TreeMaps Posted: Apr 2, 2003 7:02 PM
Reply to this message Reply
Advertisement
I want to do a union for two relations using a TreeMap, how would I do this?

cheers alan


Dhrubo

Posts: 32
Nickname: dhrubo
Registered: Mar, 2003

Re: TreeMaps Posted: Apr 2, 2003 8:30 PM
Reply to this message Reply
Hope this helps

import java.util.*;
class Union
{

public static void main(String args[])
{

TreeMap a = new TreeMap();

a.put("1","One");
a.put("2","Two");
a.put("3","Three");

System.out.println("\nBefore Union : a ===> " + a);


TreeMap b = new TreeMap();

b.put("3","Three");
b.put("4","Four");

System.out.println("\nBefore Union : b ===> " + b);

a.putAll(b);

System.out.println("\nAfter Union : a ===> " + a);

}



}

Flat View: This topic has 1 reply on 1 page
Topic: applet and MSAccess Previous Topic   Next Topic Topic: REALLY NEED HELP PLEASE ON AN ASSIGNMENT

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use