Github user doanduyhai commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/164#issuecomment-124344667
  
    Looks good to me. One possible refactoring to avoid the duplication of 
output message parsing:
    
    ```java
    private TreeMap<Integer, Type> buildIndexMap(String msg) {
        TreeMap<Integer, Type> typesLastIndexInMsg = new TreeMap<Integer, 
Type>();
        if (msg.startsWith(magic + " ") || msg.startsWith(magic + "\n")) {
            for (Type t : types){
                lastIndexOftypes = getLastIndexOfType(msg, t);
                if (lastIndexOftypes >= 0){
                    typesLastIndexInMsg.put(lastIndexOftypes, t);
                }
            }
        }
        return typesLastIndexInMsg;                 
    }
    ```
    
    And then re-use this method in `getType()` and  `getData()`


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to