ImmutableList<String> getUnfinishedLeafTasks() {
    List<Allocation> allUnfinished = getUnfinishedAllocations();
    Set<Allocation> unfinishedLeaves = new LinkedHashSet<>(allUnfinished); // preserves order

    for (Allocation allocation : allUnfinished) {
      Optional<Allocation> parent = allocation.getParent();

      while (parent.isPresent()) {
        unfinishedLeaves.remove(parent.get());
        parent = parent.get().getParent();
      }
    }

    return ImmutableList.copyOf(
        unfinishedLeaves.stream().map(Allocation::getDescription).collect(Collectors.toList()));
  }
Helper method for {@link #updateProgress(Allocation, long)}. Subtract {@code units} from {@code
indexedRemainingUnits}. Updates {@link IndexedRemainingUnits} for parent {@link Allocation}s if
remaining units becomes 0. This method is <em>not</em> thread-safe for the {@code
indexedRemainingUnits} and should be called atomically relative to the {@code
indexedRemainingUnits}.

@param indexedRemainingUnits the {@link IndexedRemainingUnits} to update progress for
@param units the units of progress
jib-core/src/main/java/com/google/cloud/tools/jib/event/progress/AllocationCompletionTracker.java