Removing an ArrayList's elements

I am new to using ArrayList's in java. I have several lists and want to write a method for removing a list with its elements. Here is what I have so far:

public void delete(double value){

After that I want get the output:

public ArrayList<Double> getlist(){
    return list;


So lets assume you have a few ArrayLists like this...

ArrayList list1;
ArrayList list2;
ArrayList list3;

Are you saying that, depending on a given value, you want to remove one of these lists? So something like this...

public void deleteList(ArrayList listToRemove){
    listToRemove = null;

public void chooseListToRemove(int listNumber){
    if (listNumber == 1){
    else if (listNumber == 2){
    else if (listNumber == 3){

Is this what you're trying to do?

Otherwise, are you saying you have a single ArrayList that contains many other lists...

ArrayList allLists;
allLists.add(new ArrayList());
allLists.add(new ArrayList());
allLists.add(new ArrayList());

And you want to remove one of these lists like this...

public void deleteList(int listNumber){

So that if you started with 3 lists in allLists and then removed 1 of them, you could ask allLists.size() and it would tell you that there are only 2 lists left?

If its neither of these, you'll really need to explain your question better so that we can help you.

From List interface:

Removes from this list all of its elements that are contained in the specified collection (optional operation).

boolean removeAll(Collection<?> c);

Need Your Help

Comprehensive server-side validation

php regex validation sql-injection server-side

I currently have a fairly robust server-side validation system in place, but I'm looking for some feedback to make sure I've covered all angles. Here is a brief outline of what I'm doing at the mom...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.