add method traverse with predicate concept