Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/5114#discussion_r154723628 --- Diff: flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java --- @@ -101,4 +106,59 @@ .setRole(role) .build(); } + + /** + * Gets a stream of values from a collection of range resources. + */ + public static LongStream rangeValues(Collection<Protos.Resource> resources) { + return resources.stream() + .filter(Protos.Resource::hasRanges) + .flatMap(r -> r.getRanges().getRangeList().stream()) + .flatMapToLong(Utils::rangeValues); + } + + /** + * Gets a stream of values from a range. + */ + public static LongStream rangeValues(Protos.Value.Range range) { + return LongStream.rangeClosed(range.getBegin(), range.getEnd()); + } + + /** + * Gets a string representation of a collection of resources. + */ + public static String print(Collection<Protos.Resource> resources) { --- End diff -- Shall we rename this method to `toString` or something similar, because `print` does not really print the string value.
---