Reputation:
Trying to run the below code in Scala. It returns a "missing parameter type" error.
def printTree(e: Element, depth: Int){
System.out.println("Number of children in element : ",e.getChildren().getClass());
System.out.println(StringUtils.repeat("\t", depth) + e.getText());
e.getChildren().stream().filter(c=>c instanceOf Element).foreach(c=>printTree((Element)c, depth+1));
}
Upvotes: 0
Views: 160
Reputation: 26046
In Scala you don't need to explicitly work with Java streams. If e.getCgildren()
return an Array
, you can omit .stream()
and the rest will compile.
Upvotes: 1