Solved

finding size

Posted on 2002-05-08
2
158 Views
Last Modified: 2011-09-20

if you take a look at my last question you will get a better understanding!

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=java&qid=20298016

how could i find out how many documents their is in the queue?

what is the total size of the queue?

cheers
0
Comment
Question by:penfold69
  • 2
2 Comments
 
LVL 24

Accepted Solution

by:
Tomas Helgi Johannsson earned 90 total points
ID: 6996801
   Hi!

  You could do something like this
         
         public int displayAll()
         {
              int iCount = 0;
              QueueNode temp = new QueueNode();
             
              temp = start;
              while (temp !=null)
              {
                   if(temp.DocumentName != ""){
                      iCount++;
                   }
                   temp = temp.next;
              }
             return iCount;
         }    

   Regards,
     Tomas Helgi
0
 
LVL 24

Expert Comment

by:Tomas Helgi Johannsson
ID: 6996807
Hi!

I didn't change the function name :(
It should be more describeing like

public int getDocumentCount(){
....
}

Regards,
  Tomas Helgi
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now