MCPcopy Create free account
hub / github.com/apache/storm / findOne

Method findOne

storm-client/src/jvm/org/apache/storm/utils/Utils.java:1489–1499  ·  view source on GitHub ↗

Find the first item of coll for which pred.test(...) returns true. @param pred The IPredicate to test for @param coll The Collection of items to search through. @return The first matching value in coll, or null if nothing matches.

(IPredicate<T> pred, Collection<T> coll)

Source from the content-addressed store, hash-verified

1487 * @return The first matching value in coll, or null if nothing matches.
1488 */
1489 public static <T> T findOne(IPredicate<T> pred, Collection<T> coll) {
1490 if (coll == null) {
1491 return null;
1492 }
1493 for (T elem : coll) {
1494 if (pred.test(elem)) {
1495 return elem;
1496 }
1497 }
1498 return null;
1499 }
1500
1501 public static <T, U> T findOne(IPredicate<T> pred, Map<U, T> map) {
1502 if (map == null) {

Callers

nothing calls this directly

Calls 2

testMethod · 0.65
entrySetMethod · 0.65

Tested by

no test coverage detected