public static String join(List<?> list, String delim) {
        int len = list.size();

        if (len == 0) return "";

        final StringBuilder result = new StringBuilder(toString(list.get(0), delim));
        for (int i = 1; i < len; i++) {
            result.append(delim);
            result.append(toString(list.get(i), delim));
        }
        return result.toString();
    }
@Test
    public void testListInListJoin() throws IOException {
        assertEquals("foo,bar,", KeyNode.join(Arrays.asList("foo", Arrays.asList("bar", null)), ","));
    }