mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-04 16:19:50 +02:00
implement iterable interface
This commit is contained in:
@@ -36,11 +36,13 @@ package sonia.scm.repository;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@@ -59,7 +61,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
*/
|
||||
@XmlRootElement(name = "blame-result")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class BlameResult implements Serializable
|
||||
public class BlameResult implements Serializable, Iterable<BlameLine>
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
@@ -139,6 +141,20 @@ public class BlameResult implements Serializable
|
||||
return Objects.hashCode(total, blameLines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @since 1.17
|
||||
*/
|
||||
@Override
|
||||
public Iterator<BlameLine> iterator()
|
||||
{
|
||||
return getBlameLines().iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
@@ -166,6 +182,9 @@ public class BlameResult implements Serializable
|
||||
*/
|
||||
public List<BlameLine> getBlameLines()
|
||||
{
|
||||
if ( blameLines == null ){
|
||||
blameLines = Lists.newArrayList();
|
||||
}
|
||||
return blameLines;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user