diff --git a/workflows/src/main/java/com/r3/developers/csdetemplate/utilities/CorDappHelpers.java b/workflows/src/main/java/com/r3/developers/csdetemplate/utilities/CorDappHelpers.java index b392a00..e66299c 100644 --- a/workflows/src/main/java/com/r3/developers/csdetemplate/utilities/CorDappHelpers.java +++ b/workflows/src/main/java/com/r3/developers/csdetemplate/utilities/CorDappHelpers.java @@ -6,18 +6,18 @@ import java.util.List; import java.util.concurrent.Callable; import java.util.function.Predicate; import java.util.stream.Collectors; -// -//public final class CorDappHelpers { -// public static T findAndExpectExactlyOne(Collection collection, Predicate filterFn, String exceptionMsg) -// { -// Collection results = collection.stream().filter(filterFn).collect(Collectors.toList()); -// if(results.size() != 1){ -// throw new RuntimeException(exceptionMsg); -// } -// return results.iterator().next(); -// } -// -// public static T findAndExpectExactlyOne(Collection collection, String exceptionMsg) { -// return findAndExpectExactlyOne(collection, e -> true, exceptionMsg); -// } -//} + +public final class CorDappHelpers { + public static T findAndExpectExactlyOne(Collection collection, Predicate filterFn, String exceptionMsg) + { + Collection results = collection.stream().filter(filterFn).collect(Collectors.toList()); + if(results.size() != 1){ + throw new RuntimeException(exceptionMsg); + } + return results.iterator().next(); + } + + public static T findAndExpectExactlyOne(Collection collection, String exceptionMsg) { + return findAndExpectExactlyOne(collection, e -> true, exceptionMsg); + } +}