Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Collections Exercise 2 - State Capitals

For the purposes of this exercise, the only data structures that need to be considered are: array, ArrayList, LinkedList, HashSet, TreeSet, HashMap, and TreeMap.

Tutorial Details:

Situation: You need to write a function that, given a state abbreviation code (a String), returns the capital city of that state (a String). You may assume there are exactly 50 state codes.

Question: What data structure would be appropriate, and how could this data structure be used? Show the following:

The data structure instance variable, m_stateCapitals, declaration and constructor call.


 

Rate Tutorial:
http://www.roseindia.net/java/java-tips/data/collections/exercises/q-collections-2.shtml

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Collections Exercise 2 - State Capitals

View Tutorial:
Collections Exercise 2 - State Capitals

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
 
Design networked applications in RMI using the Adapter design pattern
Design networked applications in RMI using the Adapter design pattern
 
Java 2 introduces print capability to the Swing Forum - JavaWorld June 1999
Java 2 introduces print capability to the Swing Forum - JavaWorld June 1999
 
Secure type-safe collections - JavaWorld April 2001
Secure type-safe collections - JavaWorld April 2001
 
The art of EJB deployment - JavaWorld August 2001
The art of EJB deployment - JavaWorld August 2001
 
Accelerate your RMI programming
Accelerate your RMI programming
 
Flex your grid layout
Flex your grid layout
 
Use XML data binding to do your laundry
Use XML data binding to do your laundry
 
Pick up performance with generational garbage collection
Pick up performance with generational garbage collection
 
Eclipse casts shadows
Eclipse casts shadows
 
Put Java in the fast lane
Put Java in the fast lane
 
Java Tip 132: The taming of the thread
Java Tip 132: The taming of the thread
 
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
 
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.
 
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
 
Site navigation
 

 

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

Copyright © 2006. All rights reserved.