I need to convert my queue to a string so that I can display it in the JaphenPan dialog box, but when I convert I do not have it in order. I know that the problem is in my toString () method, but I'm not sure how to fix it or the right way to convert it to the string in the correct order. Any suggestions friends?
Public Interface Queue & lt; T & gt; {Add Pure Zero (T element); Remove public T (); Public T element (); Public Boolean is empty (); Public full size (); } Public Class Arrayquai & lt; T & gt; Applicable queue & lt; T & gt; {Private Final INC INITIAL_SIZE = 10; // private t [] buffer; Private int front, back, count; Public opinion () {front = 0; Rear = 0; Count = 0; } T [] buffer = (t []) new object [INITIAL_SIZE]; Add Public Zero (T element) {if (count == buffer.length) addStorageSpace (); Buffer [back] = element; Rear = (rear + 1)% buffer. Lamps; Count ++; } Remove public T () {T element = buffer [front]; Front = (front + 1)% buffer; lamb; Count--; Return element; } Public T element () {return buffer [front]; } Public boolean is empty () {returns (calculation == 0); } Public full size () {return calculation; } Public string toString () {string output = ""; For (Int i = 0; I
Comments
Post a Comment