Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Collections Exercise 4 - Word Translator (Generics)

For passing over the elements of a data structure, consider only Iterator and for loop.

Tutorial Details:

Situation: An online dictionary is needed. The user will enter a word and the program will produce a list of "translations". The program begins by reading a file of definitions, which give the different possible translations of a word. For example, a simple text file might have the following structure for showing the English translation of German words.

Note that some words, like "Absatz" (I had to look it up recently), have several translations. It's necessary to store multiple translations for a given word.

Design a data structure that allows fast access, given a word (String), to its translations (a bunch of Strings).


 

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

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Collections Exercise 4 - Word Translator (Generics)

View Tutorial:
Collections Exercise 4 - Word Translator (Generics)

Related Tutorials:

Make room for JavaSpaces, Part 6 - JavaWorld October 2000
Make room for JavaSpaces, Part 6 - JavaWorld October 2000
 
Jato: The new kid on the open source block, Part 2 - JavaWorld April 2001
Jato: The new kid on the open source block, Part 2 - JavaWorld April 2001
 
Secure type-safe collections - JavaWorld April 2001
Secure type-safe collections - JavaWorld April 2001
 
Language improvements and models make great Java - JavaWorld
Language improvements and models make great Java - JavaWorld
 
Jini-like discovery for RMI
Jini-like discovery for RMI
 
Flex your grid layout
Flex your grid layout
 
A recipe for cookie management
A recipe for cookie management
 
Check out three collections libraries
Check out three collections libraries
 
SpeedJG - XML Builder
SpeedJG - XML based Java Swing GUI Builder
 
Taming Tiger
Taming Tiger, Part 2 Understanding generics Welcome to the second part of this three-part series on Sun Microsystems' latest release of the Java 2 Platform, Standard Edition (J2SE). To refresh your memory, Part 1 was a quick introduction to J2SE 1.5
 
A Generic MVC Model in Java
A Generic MVC Model in Java Model-View-Controller (MVC) is a widely used design pattern, especially popular in graphical user interface (GUI) programming. JDK 1.5 introduces parameterized types, or generics. Combining the two allows for a generic imple
 
Enforce strict type safety with generics
Java generics are the exciting new feature of Java 5 (renamed from J2SE 1.5) due for release shortly. Much controversy surrounds generics. In fact, Sam Pullara suggests that generics are just a really complicated way of implementing autocasting.
 
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
 
Create and Read J2SE 5.0 Annotations with the ASM Bytecode Toolkit
Create and Read J2SE 5.0 Annotations with the ASM Bytecode Toolkit Bytecode Attributes Annotations are actually stored in bytecode with several special attributes. The binary format for these and all other standard attributes is described in the Java Vi
 
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
 
Concurrency in JDK 5.0
Concurrency in JDK 5.0 JDK 5.0 added major new support for developing concurrent applications, including JVM changes, new low-level synchronization utilities, and higher-level, thread-safe, high-performance concurrency classes such as thread pools, concu
 
The Introduction to generic types in JDK 5.0
This tutorial introduces generic types, a new feature in JDK 5.0 that lets you define classes with abstract type parameters that you specify at instantiation time. Generics increase the type safety and maintainability of large programs. Follow along with
 
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
 
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.
 
Java theory and practice: Generics gotchas
Generic types, added in JDK 5.0, are a significant enhancement to type safety in the Java language. However, some aspects of generics may seem confusing, or even downright bizarre, to first-time users. In this month's Java theory and practice, Brian Goetz
 
Site navigation
 

 

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

Copyright © 2006. All rights reserved.