Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;

public class Main {
    public static void removeStringFromArrayList(String strItem, ArrayList<String> alItems) {

        // cycles on the arraylist
        for (int j = 0; j < alItems.size(); j++) {

            // gets the j-thg item
            String strValue = alItems.get(j);

            // if the j-th item is equal to the passed one
            if (strValue.equals(strItem)) {

                // removes it
                alItems.remove(j);

                // and returns
                return;
            }

        }

    }
}