Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Collections Exercise 3 - Points

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

Tutorial Details:

Situation: You're implementing a free drawing tool that records were the mouse has moved. A MouseMotionListener is called every time the mouse moves, and you want to record the position, as a Point object, at each of these calls. You don't know how many Points you need to store, but it will sometimes be more than 1000. You will never need to edit this series of points.

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

The data structure instance variable, m_linePoints, declaration and constructor call.
Data initialization: Show how to add new point, p, to the data structure.


 

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

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Collections Exercise 3 - Points

View Tutorial:
Collections Exercise 3 - Points

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 performance programming, Part 3: Managing collections - JavaWorld February 2000
Java performance programming, Part 3: Managing collections - JavaWorld February 2000
 
Make room for JavaSpaces, Part 6 - JavaWorld October 2000
Make room for JavaSpaces, Part 6 - JavaWorld October 2000
 
Secure type-safe collections - JavaWorld April 2001
Secure type-safe collections - JavaWorld April 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
 
A recipe for cookie management
A recipe for cookie management
 
Check out three collections libraries
Check out three collections libraries
 
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.
 
Creating EJB clients using the Eclipse Rich Client Platform
This article shows how to build a sample EJB client using the Eclipse Rich Client Platform (RCP), which has become increasingly popularity due to its extensible nature.
 
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.