First of all, let's have a look at how we would like to use the solution once it is built. Also, let's have a look at exactly which output we expect from the solution:
val target = new URL("http://mvnrepository.com/")val res = fetchToDepth(target, 1) println(res.take(10).mkString("\n")) println(res.size)
In the preceding code, we perform the following things. First of all, we would like to be able to define our URL in terms of a Java-native URL object. In this example, we are using the Maven repository website as a crawling target. mvnrepository.com is a website that provides an easy search through all of the Maven packages.
After that, we have a call to fetchToDepth. This is the method that is supposed to do the actual ...