Code example for Queue

Methods: offer

0
        return t;
    } 
 
    public void giveBack(T object) {
    	this.usedObjs.remove(object);
        this.storedObjs.offer(object);   // no point to wait for free space, just return
    } 
     
    public void giveBackAll(){ 
    	T t;
    	while ((t = usedObjs.poll())!= null){
    		this.storedObjs.offer(t);
    	} 
    } 
}