Code example for Stack

Methods: removeAllElements

0
                    ++j;
            } 
        } 
        public void removeAll() 
        { 
        	photosToLoad.removeAllElements();
        } 
    } 
     
    class PhotosLoader extends Thread {
        public void run() { 
            try { 
                while(true) 
                { 
                    //thread waits until there are any images to load in the queue 
                    if(photosQueue.photosToLoad.size()==0)
                        synchronized(photosQueue.photosToLoad){
                            photosQueue.photosToLoad.wait();
                        } 
                    if(photosQueue.photosToLoad.size()!=0)
                    {