/** * Retrieves all {@link Parcel}s. * @param state The {@link GlobalStateObject} that is used for retrieving the * parcels. * @return All parcels. */ public static ImmutableSet<Parcel> allParcels(GlobalStateObject state) { return ImmutableSet.<Parcel>builder() .addAll(state.getAvailableParcels()) .addAll(assignedParcels(state)) .build(); }
/** * Retrieves all {@link Parcel}s that are not assigned to any vehicle. * @param state The {@link GlobalStateObject} that is used for retrieving the * unassigned parcels. * @return All unassigned parcels. */ public static ImmutableSet<Parcel> unassignedParcels( GlobalStateObject state) { final Set<Parcel> set = newLinkedHashSet(state.getAvailableParcels()); set.removeAll(assignedParcels(state)); return ImmutableSet.copyOf(set); }