Pacific-Design.com

    
Home Index

1. Scala

2. Nested Objects

Scala / Nested Objects /

FOR Loop - Nested Objects


    for (i <- 0 to provider.size - 1) {
      print(provider(i) + " ")
      for (j <- 0 to provider(i).practiceLocations.size - 1) {
        println(provider(i).practiceLocations(j))
      }
    }

FOREACH - Nested Objects


        provider.foreach(
    
            p => println (
                  p.npid + " " +
                  p.providerFullName + " " +
                  p.practiceLocations.foreach(
                    s=> println(s.state + " " + s.zipCode)
                  )
            )
        )