Here you can find the source of removeFirstElement(List
Parameter | Description |
---|---|
l | the List object to process |
public static <T> T removeFirstElement(List<T> l)
//package com.java2s; /*//from www . j av a2s . co m Copyright 1996-2010 Ariba, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. $Id: //ariba/platform/util/core/ariba/util/core/ListUtil.java#38 $ */ import java.util.List; public class Main { /** Removes and returns the element at index 0, or <b>null</b> if the List is empty. @param l the List object to process @return the first element that was in the list, but has now been removed. @aribaapi documented */ public static <T> T removeFirstElement(List<T> l) { if (l.isEmpty()) { return null; } return l.remove(0); } }