File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
traversal-tests/src/test/scala/overflowdb/traversal
traversal/src/main/scala/overflowdb/traversal Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -57,9 +57,9 @@ class PathTraversalTests extends AnyWordSpec with ExampleGraphSetup {
57
57
Seq (center, r1, " R1" ))
58
58
}
59
59
60
- " collectAll: includes intermediate results (this behavior is undesired) " in {
60
+ " collectAll: does not include intermediate results " in {
61
61
centerTrav.enablePathTracking.collectAll[Thing ].path.toList shouldBe List (
62
- Seq (center, center ))
62
+ Seq (center))
63
63
}
64
64
65
65
" filter" in {
Original file line number Diff line number Diff line change @@ -61,10 +61,10 @@ class Traversal[+A](elements: IterableOnce[A])
61
61
def cast [B ]: Traversal [B ] =
62
62
this .asInstanceOf [Traversal [B ]]
63
63
64
- /** collects and all elements of the given type */
65
- @ Doc (info = " collects and all elements of the provided type" )
66
- def collectAll [B : ClassTag ] : Traversal [B ] =
67
- collect { case b : B => b}
64
+ /** collects all elements of the given class (beware of type-erasure) */
65
+ @ Doc (info = " collects all elements of the provided class (beware of type-erasure) " )
66
+ def collectAll [B ]( implicit ev : ClassTag [ B ]) : Traversal [B ] =
67
+ filter(ev.runtimeClass.isInstance). asInstanceOf [ Traversal [ B ]]
68
68
69
69
/** filters out everything that is _not_ the given value */
70
70
@ Doc (info = " filters out everything that is _not_ the given value" )
You can’t perform that action at this time.
0 commit comments