class WorkItemDefinitionClientParser {

    public static List<WorkItemDefinition> parse(String widStr) {
        if (empty(widStr)) {
            return Collections.emptyList();
        }

        List<WorkItemDefinition> widList = new ArrayList<>();
        String[] lines = widStr.split("\r\n|\r|\n");
        Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines));
        while (!linesQueue.isEmpty()) {
            String line = linesQueue.peek().trim();
            if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) {
                WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue);
                widList.add(wid);
            }
            linesQueue.poll();
        }
        return widList;
    }

}