Github user knusbaum commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1043#discussion_r50745533
  
    --- Diff: storm-core/src/jvm/org/apache/storm/utils/Utils.java ---
    @@ -1382,5 +1422,438 @@ public static TopologyInfo getTopologyInfo(String 
name, String asUser, Map storm
         public static int toPositive(int number) {
             return number & Integer.MAX_VALUE;
         }
    -}
     
    +
    +
    +    //Everything from here on is translated from the old util.clj 
(storm-core/src/clj/backtype.storm/util.clj)
    +
    +    //Wraps an exception in a RuntimeException if needed
    +    public static Exception wrapInRuntime (Exception e) {
    +        if (e instanceof RuntimeException) {
    +            return e;
    +        } else {
    +            return (new RuntimeException(e));
    +        }
    +    }
    +
    +    public static final boolean isOnWindows = 
"Windows_NT".equals(System.getenv("OS"));
    +
    +    public static final String filePathSeparator = 
System.getProperty("file.separator");
    +
    +    public static final String classPathSeparator = 
System.getProperty("path.separator");
    +
    +
    +    /*
    +        Returns the first item of coll for which (pred item) returns 
logical true.
    +        Consumes sequences up to the first match, will consume the entire 
sequence
    +        and return nil if no match is found.
    +     */
    +    public static Object findFirst (IPredicate pred, Collection coll) {
    +        if (coll == null || pred == null) {
    +            return null;
    +        } else {
    +            Iterator<Object> iter = coll.iterator();
    +            if (iter==null || !iter.hasNext()) {
    +                return null;
    +            } else {
    +                do {
    +                    Object obj = iter.next();
    +                    if (pred.test(obj)) {
    +                        return obj;
    +                    }
    +                } while (iter.hasNext());
    +                return null;
    +            }
    +        }
    +    }
    +
    +    public static Object findFirst (IPredicate pred, Map map) {
    +        if (map == null || pred == null) {
    +            return null;
    +        } else {
    +            Iterator<Object> iter = map.entrySet().iterator();
    +            if (iter==null || !iter.hasNext()) {
    +                return null;
    +            } else {
    +                do {
    --- End diff --
    
    Same here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to