Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Programming - WordFrequency modifications

The purpose of these exercises is to get practice with using some of the basic data structures.

Tutorial Details:

Around line 104 is the heart of the algorithm. Instead of putting the entries into an ArrayList and sorting them, they could be put into a TreeSet, which would naturally sort them. Use the TreeSet constructor that specifies a Comparator so it knows how to sort them, and add entry set from the HashMap to it. Then use an iterator to go over the TreeSet..

After you have the previous part running, change the Comparator near the end of the file to sort by the length of the word first, and if the lengths are the same, by the frequency. This should list the entries so that the shortest, most frequent words are last. You'll need to change the Comparator for this. See line 123...


 

Rate Tutorial:
http://www.roseindia.net/java/java-tips/data/collections/maps/q-pr-wordfreq.shtml

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Programming - WordFrequency modifications

View Tutorial:
Programming - WordFrequency modifications

Related Tutorials:

Java Tip 56: How to eliminate debugging problems for RMI-based applications - JavaWorld - July 1998
Java Tip 56: How to eliminate debugging problems for RMI-based applications - JavaWorld - July 1998
 
Create a custom Java 1.2-style ClassLoader - JavaWorld March 2000
Create a custom Java 1.2-style ClassLoader - JavaWorld March 2000
 
Product Review: Kawa 4.0 - JavaWorld June 2000
Product Review: Kawa 4.0 - JavaWorld June 2000
 
Use Microsoft's Internet Information Server as a Java servlet engine - JavaWorld June 2000
Use Microsoft's Internet Information Server as a Java servlet engine - JavaWorld June 2000
 
Brewing entity Enterprise JavaBeans - JavaWorld September 2000
Brewing entity Enterprise JavaBeans - JavaWorld September 2000
 
JSP templates - JavaWorld September 2000
JSP templates - JavaWorld September 2000
 
An open alternative to JSP - The faults of JSP So what's wrong with JSP?
How the template-based, open source API FreeMarker trumps JSP
 
Warning! Threading in a multiprocessor world - JavaWorld February 2001
Warning! Threading in a multiprocessor world - JavaWorld February 2001
 
Integrate EJBs with CORBA
Integrate EJBs with CORBA
 
Remote-control Java
Remote-control Java
 
Welcome to the WfMOpen project
WfMOpen is a J2EE based implementation of a workflow facility (workflow engine) as proposed by the Workflow Management Coalition (WfMC) and the Object Management Group (OMG).
 
Once again, only introduction
Once again, only introduction
 
Smart Value Object goes one step further
Smart Value Object goes one step further The Smart Value Object allows server components to track client-side modification of business objects in a rich client/J2EE server environment, by using the latest features offered by bytecode processing tools.
 
XStream
XStream is a simple library to serialize objects to XML and back again.
 
Ganymede
A log4j plugin to Eclipse that works similar to chainsaw (SocketServer). Includes color, filtering, detailed information, and saves settings.
 
Performance Analysis of J2EE Applications Using AOP Techniques
Performance Analysis of J2EE Applications Using AOP Techniques In this article we demonstrate the use of AOP techniques through which J2EE applications can be easily instrumented without any modifications to application code. We have developed a very sim
 
JDBC scripting, Part 2
JDBC scripting, Part 2 Programming and Java scripting in JudoScript Summary JudoScript is a rich functional scripting language, and an easy and powerful general programming and Java scripting language. JudoScript's power comes from its synergy of
 
Prova
Prova: A Language for Rule Based Java Scripting, Information Integration, and Agent Programming
 
Servlet Essentials
This document explains the concepts of Java Servlets and provides a step-by-step tutorial for writing HTTP Servlets with complete source code for the example Servlets. The tutorial and the other chapters cover all facets of Servlet programming from a ...
 
Chat Transcript: Solving the Device Fragmentation Problem
Read the questions that your fellow developers had about the new feature in NetBeans Mobility Pack 4.0 that helps solve device fragmentation problems, and the answers straight from the engineers who created the module.
 
Site navigation
 

 

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

Copyright © 2006. All rights reserved.