public static void main(String args[]) {
        IntegerListParser integerListParser = new IntegerListParser();
        NestedInteger nestedInteger = integerListParser.deserialize("123");
        String result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
        nestedInteger = integerListParser.deserialize("[]");
        result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
        nestedInteger = integerListParser.deserialize("[123]");
        result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
        nestedInteger = integerListParser.deserialize("[123,41]");
        result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
        nestedInteger = integerListParser.deserialize("[123,41,[1]]");
        result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
        nestedInteger = integerListParser.deserialize("[123,41,[[[]]]]");
        result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
        nestedInteger = integerListParser.deserialize("[123,41,[[[],[]]]],[],[]");
        result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
        nestedInteger = integerListParser.deserialize("[123,41,[[[121,41,[1]],[2]]]],[2],[4]");
        result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
        nestedInteger = integerListParser.deserialize("[123,41,[[1,2,[],[]]]],[],[],[[1],[3]]");
        result = integerListParser.serialize(nestedInteger);
        System.out.println(result);
    }
Date 10/10/2016
@author Tushar Roy

Given a nested list of integers represented as a string, implement a parser to deserialize it.
Each element is either an integer, or a list -- whose elements may also be integers or other lists.

https://leetcode.com/problems/mini-parser/
src/com/interview/misc/IntegerListParser.java