| final TreeItem<String> trunk, | ||
| final StringPredicate predicate ) { | ||
| - final List<TreeItem<String>> branches = trunk.getChildren(); | ||
| TreeItem<String> result = null; | ||
| - for( final TreeItem<String> leaf : branches ) { | ||
| - if( predicate.test( leaf.getValue() ) ) { | ||
| - result = leaf; | ||
| - break; | ||
| + if( trunk != null ) { | ||
| + final List<TreeItem<String>> branches = trunk.getChildren(); | ||
| + | ||
| + for( final TreeItem<String> leaf : branches ) { | ||
| + if( predicate.test( leaf.getValue() ) ) { | ||
| + result = leaf; | ||
| + break; | ||
| + } | ||
| } | ||
| } |
| Author | djarvis <email> |
|---|---|
| Date | 2016-12-29 12:03:51 GMT-0800 |
| Commit | b12479fc7528a3f4e2bc8f13c7844a18ec73e8c1 |
| Parent | 2886b41 |
| Delta | 8 lines added, 5 lines removed, 3-line increase |