summaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-11-08 12:17:16 +0100
committerJon Marius Venstad <venstad@gmail.com>2019-11-11 08:28:01 +0100
commitea83ed12a7583335c77329be9afd415849263354 (patch)
tree9e9b4034971ae3f270382d11a2d0a41397719538 /vespajlib
parent4faca41f28583c4fd6d8d27e8cc22f0d5071bd35 (diff)
Consider all known runs when checking whether versions are verified
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/collections/AbstractFilteringList.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/collections/AbstractFilteringList.java b/vespajlib/src/main/java/com/yahoo/collections/AbstractFilteringList.java
index efcdeeaebfc..c64a9ada410 100644
--- a/vespajlib/src/main/java/com/yahoo/collections/AbstractFilteringList.java
+++ b/vespajlib/src/main/java/com/yahoo/collections/AbstractFilteringList.java
@@ -4,6 +4,7 @@ import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
+import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BiFunction;
import java.util.function.Function;
@@ -50,6 +51,11 @@ public abstract class AbstractFilteringList<Type, ListType extends AbstractFilte
return constructor.apply(items.subList(negate ? n : 0, negate ? items.size() : n), false);
}
+ /** Returns the first item in this list, or empty if there is none. */
+ public Optional<Type> first() {
+ return items.stream().findFirst();
+ }
+
/** Returns the subset of items in this which are (not) present in the other list. */
public ListType in(ListType others) {
return matching(new HashSet<>(others.asList())::contains);