+-------------------------+ | Traversal |<.......................................................................... +-------------------------+ : : | boolean isEmpty() | : : | T getFirst() | : : | Traversal getRest() | : : +-------------------------+ : : / \ / \ : : --- --- : : | | : : +------------+ +------------------+ : : | IList |<-+ | : : +------------+ | +----------------------------------------------------+ : : / \ | | WrapAL | : : --- +-------------+ +----------------------------------------------------+ : : | | | ArrayList arrlist | : : ------------------- | | int first | : : | | | +----------------------------------------------------+ : : +-----------+ +----------------+ | | public WrapAL(ArrayList arrlist) | : : | MTList | | ConsList | | | private WrapAL(ArrayList arrlist, int first) | : : +-----------+ +----------------+ | +----------------------------------------------------+ : : | T first | | : : | IList rest |-+ : : +----------------+ : : +------------------------------------------------------+ : : | Algorithms | : : +------------------------------------------------------+ : : ..............................| boolean orMap(Traversal tr, Predicate pick) |..: : : ............| int countSuch(Traversal tr, Predicate pick) |....: : : +------------------------------------------------------+ v v +-----------------------------+ | Predicate | +-----------------------------+ | boolean apply(T t) | +-----------------------------+ / \ / \ --- --- | | +--------------------------+ +--------------------------+ | | | | | RedBalloon | | SmallBalloon | +--------------------------+ +--------------------------+ | boolean apply(Balloon b) | | boolean apply(Balloon b) | +--------------------------+ +--------------------------+ +---------- | Examples +-------------- | Traversal blist: ConsList | ... | ISelect redBalloon: RedBalloon ... | Algorithms methods: Algorithms |...................... | algo.orMap(blist, redBalloon) -> boolean | ...