Uploaded image for project: 'REEF (Retired)'
  1. REEF (Retired)
  2. REEF-1074

Merge `parseList` and `parseListCmp` into one generic function

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.14
    • REEF-IO
    • None

    Description

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

      • As-Is
        Utils.java
          /**
           * 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;
          }
        
      • To-Be
        Utils.java
        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;
        }
        

      Attachments

        Issue Links

          Activity

            People

              dongjoon Dongjoon Hyun
              dongjoon Dongjoon Hyun
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: