public static Predicate<Object> byFixedGeneration(final long generation) {
		if (generation < 0) {
			throw new IllegalArgumentException(format(
				"The number of generations must greater than one, but was %d",
				generation
			));
		}

		return new Predicate<Object>() {
			private final AtomicLong _current = new AtomicLong();
			@Override
			public boolean test(final Object o) {
				return _current.incrementAndGet() <= generation;
			}
		};
	}
public static Predicate < Object > byFixedGeneration ( final long generation ) { if ( generation < 0 ) { throw new IllegalArgumentException ( format ( "The number of generations must greater than one, but was %d" , generation ) ) ; } return new Predicate < Object > ( ) { private final AtomicLong _current = new AtomicLong ( ) ; @ Override public boolean test ( final Object o ) { return _current . incrementAndGet ( ) <= generation ; } } ; }
Return a predicate, which will truncate the evolution stream after the
given number of generations. The returned predicate behaves like a call
of the {@link java.util.stream.Stream#limit(long)} and exists for
<i>completeness</i> reasons.

@since 3.1

@param generation the number of generations after the evolution stream is
truncated
@return a predicate which truncates the evolution stream after the given
number of generations
@throws java.lang.IllegalArgumentException if the given {@code generation}
is smaller than zero.