1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-11 20:05:04 -05:00
filebot/source
Reinhard Pointner a9285d53fd [!] Stream.count() may short-circuit and not traverse any elements at all.
@apiNote
An implementation may choose to not execute the stream pipeline (either sequentially or in parallel) if it is capable of computing the count directly from the stream source. In such cases no source elements will be traversed and no intermediate operations will be evaluated. Behavioral parameters with side-effects, which are strongly discouraged except for harmless cases such as debugging, may be affected. For example, consider the following stream:

List<String> l = Arrays.asList("A", "B", "C", "D");
long count = l.stream().peek(System.out::println).count();

The number of elements covered by the stream source, a List, is known and the intermediate operation, peek, does not inject into or remove elements from the stream (as may be the case for flatMap or filter operations). Thus the count is the size of the List and there is no need to execute the pipeline and, as a side-effect, print out the list elements.
2019-05-20 13:13:12 +07:00
..
META-INF/groovy Fix dateutil methods in case groovy extension methods dont work 2018-12-03 03:19:54 +07:00
net/filebot [!] Stream.count() may short-circuit and not traverse any elements at all. 2019-05-20 13:13:12 +07:00
ehcache.xml Experiment with new CachedResource framework 2016-03-06 22:21:13 +00:00