Walt Walt - 3 months ago 30
Java Question

Can I use Hamcrest's Matchers.containsInRelativeOrder?

I'm a little confused. I see function

in the code:

public static <E> org.hamcrest.Matcher<java.lang.Iterable<? extends E>> containsInRelativeOrder(E... items) {
return org.hamcrest.collection.IsIterableContainingInRelativeOrder.containsInRelativeOrder(items);

but I'm getting a method-not-found error when I try to use that method (with Hamcrest 1.3) and I don't see it in the javadoc.

Is this a version issue? Is the method not present in 1.3?

cxw cxw

Corrected thanks to @Tom.

Yes, it is a version issue! 1.3 is from 2012. The function was added in Dec. 2014 by commit 99bc9421a719782c6357f991c891af48d6e9de4a.

The first version of this function was added in Nov. 2014 by commit 5ed2d06688f9d3b445b98b13056223b79318a614. At that time, it lived in a separate file, collection/IsIterableContainingInRelativeOrder.java.