### Question:
LocationSet extends AbstractSet<Location> { public Location first() { Location first = null; for (Location location : locations) { if (first == null || first.getId() > location.getId()) { first = location; } } return first; } LocationSet(Collection<? extends Location> locations); LocationSet where(Predicate<? super Location> filter); LocationSet whereConditionally(Predicate<? super Location> filter); GeoCoordinate midpoint(); GeoCoordinate center(); double largestDistance(); Stats distanceStats(Location location); double minDistance(GeoCoordinate coordinate); double maxDistance(GeoCoordinate coordinate); Set<GeoCoordinate> coordinates(); Location biggest(); long biggestPopulation(); long totalPopulation(); int maxHierarchyDepth(); boolean contains(Location location); @Override int size(); @Override Iterator<Location> iterator(); Location first();  }### Answer:
@Test public void testFirst() { LocationSet stats = new LocationSet(Arrays.asList(l1, l2, l3, l4)); assertEquals(2028461, stats.first().getId()); stats = new LocationSet(Collections.<Location>emptySet()); assertNull(stats.first()); }