Collections & Lambdas

Many values, one name

A walker covers several neighborhoods, an owner has several bookings, the backend returns a list of walkers. A List is an ordered collection of values that all share one type. The type is written in angle brackets β€” List<String> is "list of String" β€” and a literal is built with listOf(...). That's exactly what Walker.neighborhoods is.

Lists come with built-in properties and functions: .size (how many), .isEmpty() (is it zero?), and .firstOrNull() (the first element β€” as a nullable, because the list might be empty).