79641493

Date: 2025-05-28 04:21:44
Score: 0.5
Natty:
Report link


    static List<Object> parseList(String input, String key) {
        List<Object> list = new ArrayList<>();
        Deque<Character> stack = new ArrayDeque<>();
        StringBuilder token = new StringBuilder();
        for (int i = 0; i <= input.length(); i++) {
            char c = (i < input.length()) ? input.charAt(i) : ',';
            if (c == '(' || c == '[') stack.push(c);
            else if (c == ')' || c == ']') stack.pop();

            if (c == ',' && stack.isEmpty()) {
                list.add(parseValueFromString(token.toString().trim(), key));
                token.setLength(0);
            } else {
                token.append(c);
            }
        }
        return list;
    }

   
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: abhi