Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-10-05 11:42:52 +0000
committerEike Stepper2012-10-05 11:42:52 +0000
commitbd3e3935ef223f341b10072f13427d5e124ff760 (patch)
tree5c9b70c19df185c6f70e4e8a07add966f2e373e9 /plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java
parent9699c005e9832e03bf0d150f881a72df71b69880 (diff)
downloadcdo-bd3e3935ef223f341b10072f13427d5e124ff760.tar.gz
cdo-bd3e3935ef223f341b10072f13427d5e124ff760.tar.xz
cdo-bd3e3935ef223f341b10072f13427d5e124ff760.zip
[256624] [UI] Create a Commit History ViewPart drops/I20121005-0745
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256624
Diffstat (limited to 'plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java')
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java
new file mode 100644
index 0000000000..2a4b1a90d7
--- /dev/null
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/PredicateIterator.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.util.collection;
+
+import java.util.Iterator;
+
+/**
+ * @author Eike Stepper
+ * @since 3.3
+ */
+public class PredicateIterator<T> extends AbstractFilteredIterator<T>
+{
+ private final Predicate<? super T> predicate;
+
+ public PredicateIterator(Iterator<T> delegate, Predicate<? super T> predicate)
+ {
+ super(delegate);
+ this.predicate = predicate;
+ }
+
+ public Predicate<? super T> getPredicate()
+ {
+ return predicate;
+ }
+
+ @Override
+ protected boolean isValid(T element)
+ {
+ return predicate.apply(element);
+ }
+}

Back to the top