public  synchronized int getItem() throws InterruptedException
     {  
        if(warehouse.isEmpty()||warehouse.iterator().next()==null||consumedItemsCount>=warehouse.size())
            wait();
        return   warehouse.get(consumedItemsCount++) ;
     }