Code example for Queue

Methods: peek, poll

0
     * Queue 
     *  
     * @return A appWidgetId need to be update next. 
     */ 
    private static int getNextUpdate() { 
        if (sAppWidgetIds.peek() == null) {
            return AppWidgetManager.INVALID_APPWIDGET_ID;
        } else { 
            return sAppWidgetIds.poll();
        } 
    } 
 
    /** 
     * The main function used to get and parse the weather data from the Google 
     * website. And store the data in weatherData. 
     *  
     * @param city The city need to get the weather data. 
     */ 
    public void search(String city) {
 
        Log.i(LOGTAG, "search(" + city + ")");