O'Reilly logo

Java Cookbook by Ian F. Darwin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Structuring Data with Java

Introduction

Almost every application beyond “Hello World” needs to keep track of a certain amount of data. A simple numeric problem might work with three or four numbers only, but in most applications there are groups of similar data items. A GUI-based application may need to keep track of a number of dialog windows. A personal information manager or PIM needs to keep track of a number of, well, persons. An operating system (a real one) needs to keep track of who is allowed to log in, who is currently logged in, and what those users are doing. A library needs to keep track of who has books checked out and when they’re due. A network server may need to keep track of its active clients. There are several patterns here, and they all revolve around what has traditionally been called data structuring.

There are data structures in the memory of a running program; there is structure in the data in a file on disk; and there is structure in the information stored in a database. In this chapter we concentrate on the first aspect: in-memory data. We’ll cover the second aspect in Chapter 9, and the third in Chapter 20.

If you had to think about in-memory data, you might want to compare it to a collection of index cards in a filing box, or to a treasure hunt where each clue leads to the next. Or you might think of it like my desk -- apparently scattered, but actually a very powerful collection filled with meaningful information. Each of these is a good ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required