Solved

java collections

Posted on 2009-05-08
1
204 Views
Last Modified: 2013-11-23
I have to  print a paper book with indexes at the end. I have a 400 pages of english text running with only (Ctrl+L) separating each page. Now i want to create index of this book just as we have at the back of the book. What java collections i would use and how would i do it?

Also after creating the index, what is the way to print the whole book
0
Comment
Question by:SunScreenCert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
hazgoduk earned 50 total points
ID: 24343205
Not quite sure what you're asking for but a LinkedHashMap could be useful if you wanted to do something like

Java - page 8-10, 12

etc assuming you know what content is on what page.
LinkedHashMap<String, String> pageIndex = new LinkedHashMap();
pageIndex.put("Java", "8-10, 12");
pageIndex.put("LinkedHashMaps", "13");
 
Iterator<String> itKeys = pageIndex.keySet().iterator();
String key = "";
String currentLetter = "";
if(itKeys.hasNext())
{
    do
    {
        key = itKeys.next();
 
        if(!key.startsWith(currentLetter)
        {
            currentLetter = key.substring(0,1);
            System.out.println("\n\n" + currentLetter + "\n");
        }
 
        System.out.println(key + ": " + pageIndex.get(key));
    }while(itKeys.hasNext());
}

Open in new window

0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question