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
- relates to
-
REEF-525 Add missing Javadoc comments/triage TODO notes in Java code: reef-io
- Open
- links to