Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;
import java.util.Iterator;

public class Main {
    public static boolean remove(Collection collection, Object object) {
        boolean removed = false;
        Iterator it = collection.iterator();
        while (it.hasNext()) {
            Object o = it.next();
            if (o.equals(object)) {
                removed = true;
                it.remove();
                break;
            }
        }

        return removed;
    }
}