A JAVA Function !!! [Problem NOT of the week]

As my two friend Alaa & Foaud are writing [Problem of the week] 

i am also writing Problem NOT of the week :D

bcoz i wont write a problem weekly in addition to i dont know the solution of my problems :)

almost... . .

during my internship time i spent in Mentor Graphics Cairo i needed to implement a function and when i started coding i found that it was impossible to do it that way

may be there is a way that function can be implemented but i dont know how due to my small experience with JAVA Here is the problem definition:

Programming Language used : of course u know its JAVA what r u looking at :P

Problem context:

-I have an object of type Design

-I have an object of type Diagram

-The Design contains one or more Diagrams


-I have an Iterator<Design>

-form that iterator i need the next Design and an Iterator<Diagram> and a Diagram

-The function should return boolean value weather it succeeded or not

My First implementation was:

boolean getNext ( Iterator<Design> designs , Design currentDesign , Iterator<Diagram> Diagrams , Diagram currentDiagram ) 
      if (! designs.HasNext() )
           return false;
     currentDesign = designs.next();
     Diagrams = currentDesign.getDiagramIterator();
     currentDiagram = Diagrams.next();
     return true; //It compleeeetly didn't work because JAVA has no passing by reference !!!

note:    i cant make the three variables ( currentDesign , Diagrams, currentDiagram ) global as they are created in the calling function    

What did i do ..... Copy & Paste those line every where i needed that function :P

Alsalam alikom wa ramat Allah wa barakatoh Nice post, I've a request though, can you provide full posts in RSS ? your current mode displays only a brief of each post you have... if you are worried about tracking your userbase, you can use Feedburner.com :D ... I'm not sure how wordpress handles this anyway, but I'll be glad to receive full posts in RSS :D Thanks, Haytham
ok it provides now :)
[...] Countable Objects [Problem NOT of the&#160;week] Long time since the first problem.. [...]