All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.bdeploy.common.util.CollectionHelper Maven / Gradle / Ivy

Go to download

Public API including dependencies, ready to be used for integrations and plugins.

There is a newer version: 7.4.0
Show newest version
package io.bdeploy.common.util;

import java.util.List;
import java.util.function.Predicate;

public class CollectionHelper {

    private CollectionHelper() {
        // static helper.
    }

    /**
     * Searches for the index of an element in the list by using a predicated.
     */
    public static  int indexOf(List list, Predicate match) {
        for (int i = 0; i < list.size(); ++i) {
            if (match.test(list.get(i))) {
                return i;
            }
        }
        return -1;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy