13/05/04 01:23:48.47
>>415
サンプルコードを見たいならテストコードを見るのが一番手っ取り早いぞ。一つ賢くなったね。
URLリンク(github.com)
830行
@Test
public void testMap() throws Exception {
assertEquals(
Arrays.asList("1", "2", "3", "4", "1", "3", "1", "2"),
$.find("book").map(JOOX.ids()));
assertEquals(
Arrays.asList("Amazon", "Roesslitor", "Orell Fuessli"),
$.find("library").map(JOOX.attrs("name")));
assertEquals(Arrays.asList(0, 1, 2, 3), $.children().first().find("book").map(new Mapper<Integer>() {
@Override
public Integer map(Context context) {
assertEquals(context.element(), context.match());
assertEquals(context.elementIndex(), context.matchIndex());
assertEquals(context.elementSize(), context.matchSize());
assertEquals(4, context.matchSize());
return context.matchIndex();
}
}));
}