Token { public static Token parse(final String s, final char open, final char sep, final char close) { final Token root = new Token(null, open, sep, close); Token t = root; for(int i = 0; i < s.length(); i++) { t = t.parseChar(s.charAt(i)); } return root; } Token(final Token parent, final char open, final char sep, final char close); static Token parse(final String s, final char open, final char sep, final char close); @Override String toString(); String toInfixString(); String toPostfixString(); String getContent(); List<Token> getChildren();  }
@Test public void testParse() throws Exception { final Token p = Token.parse("java.util.Map<java.util.Optional<java.util.String>,Java.Util.Optional<Pair<Integer,String>>>", '<', ',','>'); System.out.println(p.toString()); Assert.assertEquals("java.util.Map<java.util.Optional<java.util.String>,Java.Util.Optional<Pair<Integer,String>>>", p.toString()); }