JsonParseUtil { public static List<Date> parserDateList(JsonPullParser parser) throws IOException, JsonFormatException { State eventType = parser.getEventType(); if (eventType == State.VALUE_NULL) { return null; } if (eventType != State.START_ARRAY) { throw new IllegalStateException("not started brace!"); } List<Date> list = new ArrayList<Date>(); while (parser.lookAhead() != State.END_ARRAY) { eventType = parser.getEventType(); if (eventType == State.VALUE_NULL) { list.add(null); } else if (eventType == State.VALUE_LONG) { list.add(new Date(parser.getValueLong())); } else { throw new IllegalStateException("unexpected state. expected=VALUE_LONG, but get=" + eventType.toString()); } } parser.getEventType(); return list; }  static Integer parserInteger(JsonPullParser parser); static Long parserLong(JsonPullParser parser); static Byte parserByte(JsonPullParser parser); static Short parserShort(JsonPullParser parser); static Boolean parserBoolean(JsonPullParser parser); static Character parserCharacter(JsonPullParser parser); static Double parserDouble(JsonPullParser parser); static Float parserFloat(JsonPullParser parser); static List<Integer> parserIntegerList(JsonPullParser parser); static List<Long> parserLongList(JsonPullParser parser); static List<Byte> parserByteList(JsonPullParser parser); static List<Short> parserShortList(JsonPullParser parser); static List<Boolean> parserBooleanList(JsonPullParser parser); static List<Character> parserCharacterList(JsonPullParser parser); static List<Double> parserDoubleList(JsonPullParser parser); static List<Float> parserFloatList(JsonPullParser parser); static List<String> parserStringList(JsonPullParser parser); static List<Date> parserDateList(JsonPullParser parser); static List<T> parserEnumList(JsonPullParser parser, Class<T> clazz);  }
@Test public void parserDateList() throws IOException, JsonFormatException { String json = "[10000000,10010001,10020002]"; JsonPullParser parser = JsonPullParser.newParser(json); List<Date> list = JsonParseUtil.parserDateList(parser); assertThat(list.size(), is(3)); assertThat(list.get(0).getTime(), is(10000000L)); assertThat(list.get(1).getTime(), is(10010001L)); assertThat(list.get(2).getTime(), is(10020002L)); }