reef-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dongjoon Hyun (JIRA)" <j...@apache.org>
Subject [jira] [Created] (REEF-1074) Merge `parseList` and `parseListCmp` into one generic function
Date Sat, 12 Dec 2015 13:58:46 GMT
Dongjoon Hyun created REEF-1074:
-----------------------------------

             Summary: Merge `parseList` and `parseListCmp` into one generic function
                 Key: REEF-1074
                 URL: https://issues.apache.org/jira/browse/REEF-1074
             Project: REEF
          Issue Type: Improvement
          Components: REEF-IO
            Reporter: Dongjoon Hyun
            Assignee: Dongjoon Hyun
            Priority: Minor


This issue merges `parseList` and `parseListCmp` functions into one generic function.

* As-Is
{code:title=Utils.java|borderStyle=solid}
  /**
   * TODO: Merge with parseListCmp() into one generic implementation.
   */
  public static List<Identifier> parseList(
      final String ids, final IdentifierFactory factory) {
    final List<Identifier> result = new ArrayList<>();
    for (final String token : ids.split(DELIMITER)) {
      result.add(factory.getNewInstance(token.trim()));
    }
    return result;
  }

  /**
   * TODO: Merge with parseList() into one generic implementation.
   */
  public static List<ComparableIdentifier> parseListCmp(
      final String ids, final IdentifierFactory factory) {
    final List<ComparableIdentifier> result = new ArrayList<>();
    for (final String token : ids.split(DELIMITER)) {
      result.add((ComparableIdentifier) factory.getNewInstance(token.trim()));
    }
    return result;
  }
{code}

* To-Be
{code:title=Utils.java|borderStyle=solid}
  public static <T extends Identifier> List<T> parseList(final String ids, final
IdentifierFactory factory) {
    final List<T> result = new ArrayList<>();
    for (final String token : ids.split(DELIMITER)) {
      result.add((T) factory.getNewInstance(token.trim()));
    }
    return result;
  }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message