Skip to content

Commit cafc6a2

Browse files
committed
Cleanups (templating etc) for Java 7
1 parent 73ecf21 commit cafc6a2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public IsIterableContainingInRelativeOrder(List<Matcher<? super E>> matchers) {
1919

2020
@Override
2121
protected boolean matchesSafely(Iterable<? extends E> iterable, Description mismatchDescription) {
22-
MatchSeriesInRelativeOrder<E> matchSeriesInRelativeOrder = new MatchSeriesInRelativeOrder<E>(matchers, mismatchDescription);
22+
MatchSeriesInRelativeOrder<E> matchSeriesInRelativeOrder = new MatchSeriesInRelativeOrder<>(matchers, mismatchDescription);
2323
matchSeriesInRelativeOrder.processItems(iterable);
2424
return matchSeriesInRelativeOrder.isFinished();
2525
}
@@ -77,8 +77,9 @@ public boolean isFinished() {
7777
* @param items
7878
* the items that must be contained within items provided by an examined {@link Iterable} in the same relative order
7979
*/
80+
@SafeVarargs
8081
public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(E... items) {
81-
List<Matcher<? super E>> matchers = new ArrayList<Matcher<? super E>>();
82+
List<Matcher<? super E>> matchers = new ArrayList<>();
8283
for (E item : items) {
8384
matchers.add(equalTo(item));
8485
}
@@ -96,6 +97,7 @@ public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(E... it
9697
* @param itemMatchers
9798
* the matchers that must be satisfied by the items provided by an examined {@link Iterable} in the same relative order
9899
*/
100+
@SafeVarargs
99101
public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers) {
100102
return containsInRelativeOrder(asList(itemMatchers));
101103
}
@@ -112,6 +114,6 @@ public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(Matcher
112114
* an examined {@link Iterable} in the same relative order
113115
*/
114116
public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(List<Matcher<? super E>> itemMatchers) {
115-
return new IsIterableContainingInRelativeOrder<E>(itemMatchers);
117+
return new IsIterableContainingInRelativeOrder<>(itemMatchers);
116118
}
117119
}

0 commit comments

Comments
 (0)