You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2016/02/09 22:47:11 UTC
svn commit: r1729466 -
/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/PositiveIntSet.java
Author: schor
Date: Tue Feb 9 21:47:11 2016
New Revision: 1729466
URL: http://svn.apache.org/viewvc?rev=1729466&view=rev
Log:
[UIMA-4674] add forAllInts based on Java 8 capabilities to PositiveIntSet
Modified:
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/PositiveIntSet.java
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/PositiveIntSet.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/PositiveIntSet.java?rev=1729466&r1=1729465&r2=1729466&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/PositiveIntSet.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/PositiveIntSet.java Tue Feb 9 21:47:11 2016
@@ -18,6 +18,8 @@
*/
package org.apache.uima.internal.util;
+import java.util.function.IntConsumer;
+
public interface PositiveIntSet {
/**
@@ -110,4 +112,16 @@ public interface PositiveIntSet {
* @return true if the position is between the first and last element inclusive.
*/
boolean isValid(int position);
+
+ /**
+ * Iterate over the positive int set in sort order, and run the consumer on each value
+ * @param v the consumer to run
+ */
+
+ default void forAllInts(IntConsumer v) {
+ IntListIterator it = iterator();
+ while (it.hasNext()) {
+ v.accept(it.next());
+ }
+ }
}
\ No newline at end of file