Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an "OrderList"
and I need to delete the first number

--------------------------------------------

C#
public void delFirst()
{
  //???????
}
public void delLast()
{
  if (!isEmpty())
  {
      size--;
  }
}

Posted
Comments
Maciej Los 26-Oct-14 17:13pm    
list.remove(0);

stop cross/multiple posting ! post once, in one forum please
 
Share this answer
 
You can remove elements by index. For example:
XML
ArrayList<String> list = new ArrayList<String>();
int size = list.size();
int firstIndex = 0;
int lastIndex = size - 1;
list.remove(firstIndex);
list.remove(lastIndex);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900