Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Collections Exercise 2a - State Capital Output

The solution to mapping from a state code (eg, "MI", "NY", ...) to its capital city ("Lansing", "Albany", ...) is to use a HashMap.

Tutorial Details:

The solution to mapping from a state code (eg, "MI", "NY", ...) to its capital city ("Lansing", "Albany", ...) is to use a HashMap.

Problem: Given a populated HashMap, write a method, printCapitals(HashMap caps), which print the capitals and their state. For example,

Lansing, MI
Albany, NY


 

Rate Tutorial:
http://www.roseindia.net/java/java-tips/data/collections/exercises/q-pr-state-capitals-output-2a.shtml

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Collections Exercise 2a - State Capital Output

View Tutorial:
Collections Exercise 2a - State Capital Output

Related Tutorials:

The battle of the container frameworks: which should you use? - JavaWorld - January 1999
The battle of the container frameworks: which should you use? - JavaWorld - January 1999
 
Java Tip 71: Use dynamic messaging in Java - JavaWorld - April 1999
Java Tip 71: Use dynamic messaging in Java - JavaWorld - April 1999
 
Create dynamic images in Java servlets - JavaWorld May 2000
Create dynamic images in Java servlets - JavaWorld May 2000
 
Easy Java/XML integration with JDOM, Part 1 - JavaWorld May 2000
Easy Java/XML integration with JDOM, Part 1 - JavaWorld May 2000
 
Easy Java/XML integration with JDOM, Part 2 - JavaWorld July 2000
Easy Java/XML integration with JDOM, Part 2 - JavaWorld July 2000
 
Secure type-safe collections - JavaWorld April 2001
Secure type-safe collections - JavaWorld April 2001
 
Talking Java! - JavaWorld August 2001
Talking Java! - JavaWorld August 2001
 
Put Java in the fast lane
Put Java in the fast lane
 
Java's character and assorted string classes support text-processing
Java's character and assorted string classes support text-processing
 
Trustin Lee\'s String/Object Converter - Changes
TL-convert Trustin Lee's String/Object Converter provides a simple API to convert Java objects into strings and vice versa. It is developed to replace Jakarta Commons BeanUtils and Jakarta Commons Convert and to provide only String/Object converters.
 
From Writing Programs to Creating Compilers
From Writing Programs to Creating Compilers In this article we build a simple compiler that augments Java with tasks (independent blocks of code that execute in parallel), thus creating a new language called AJ that well supports the programming of syste
 
Gain SQL SELECT functionality in Java
Gain SQL SELECT functionality in Java Summary In "Filter Collections," David Rappoport described a simple way to filter collections of objects. In this article, he expands on this idea and shows you how to treat an array or a collection of objects the s
 
Excellent Guide to Java / Databases, JDBC
JDBC is a Java API for executing SQL statements. Start here, Examples Central Sites Related Sites, Link Collections Tutorials, FAQs, References Company Newsgroups Mailing Lists, General Articles, Special Articles, Interoperability Books util
 
FOP is the world's first print formatter driven by XSL formatting objects.
It is a Java application that reads a formatting object tree and then turns it into a PDF document. The formatting object tree, can be in the form of an XML document (output by an XSLT engine like XT or Xalan) or can be passed in memory as a DOM Document
 
This tutorial shows how to Creating Custom JSP Tag Libraries
JSP 1.1 introduced an extremely valuable new capability: the ability to define you own JSP tags. You Define how the tag, its attributes, and its body are interpreted, then group your tags into collections called tag libraries that can be used in any numbe
 
Jajuk is a Java music organizer for all platforms
Jajuk is a Java music organizer for all platforms. The main goal of this project is to provide a fully-featured application to advanced users with large or scattered music collections. Jajuk supports MP3, OGG Vorbis, AU, AIFF, WAV and SPEEX audio formats.
 
Using and Programming Generics in J2SE 5.0
Generics, one of the most frequently requested language extensions to the Java programming language, have been added in J2SE 5.0. This article provides an introduction to programming with generics.
 
Using Beans in JSP. A brief introduction to JSP and Java Beans.
Using Beans in JSP. A brief introduction to JSP and Java Beans. USING BEANS IN JSP Java Beans Java Beans are reusable components. They are used to separate Business logic from the Presentation logic. Internally, a bean is just an instance of a
 
Solaris Patch Management: Recommended Strategy (pdf)
This Sun BluePrints article describes types of patches, patch interrelationships, and patch delivery collections, with recommended practices for maintaining properly patched and updated software. Included is an explanation of what goes into a Solaris soft
 
A Practical Roadmap for Deploying Enterprise Web Applications: Taking the First Step
This article covers important decision points around the availability, scalability, and security that are needed for enterprise web applications.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.