pkuwm edited a comment on issue #357: [WIP] Add getWorkflows(long timeout) to TaskDriver. URL: https://github.com/apache/helix/pull/357#issuecomment-514336391 I personally don't like null, either, since I see it as anti-pattern. Why I put null in this draft was I saw `return null` as well in the source code and would like to make it consistent in the project. And I thought null check is similar as isWFConfig() check. Right, functional/streams would benefit a lot from Optional. Anyway, I would implement this in the way of using isWFConfig(). FYI, my opinion is we could use Optional in this way like this, which might look more intuitive to me than null/exception. ```java public static Optional<WorkflowConfig> parseWorkflowConfig(HelixProperty property) { Map<String, String> configs = property.getRecord().getSimpleFields(); if (!configs.containsKey(WorkflowConfigProperty.Dag.name())) { return Optional.empty(); } return Optional.of(Builder.fromMap(configs).setWorkflowId(property.getId()).build()); } ``` ```java for (Map.Entry<String, ResourceConfig> resource : resourceConfigMap.entrySet()) { String key = resource.getKey(); ResourceConfig resourceConfig = resource.getValue(); WorkflowConfig.parseWorkflowConfig(resourceConfig) .ifPresent(w -> workflowConfigMap.put(key, x)); } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
