Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

package org.apache.hadoop.hbase;

import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;

import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionReplicaUtil;
import org.apache.hadoop.hbase.util.Bytes;
Expand All @@ -31,7 +34,7 @@
* (assuming small number of locations)
*/
@InterfaceAudience.Private
public class RegionLocations {
public class RegionLocations implements Iterable<HRegionLocation> {

private final int numNonNullElements;

Expand Down Expand Up @@ -361,6 +364,11 @@ public HRegionLocation getRegionLocation() {
return null;
}

@Override
public Iterator<HRegionLocation> iterator() {
return Arrays.asList(locations).iterator();
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder("[");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;

/**
* Convenience class for composing an instance of {@link TableDescriptor}.
* @since 2.0.0
*/
@InterfaceAudience.Public
Expand Down
5 changes: 5 additions & 0 deletions hbase-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's where the collection matchers live. See the test where I make assertions over the contents of lists using the contains method. That comes from the library. In reality, all the useful stuff for Hamcrest comes out of the Matchers class provided by hamcrest-library.

<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
Expand Down
Loading