com.atlassian.bamboo.util
Class BambooIterables

java.lang.Object
  extended by com.atlassian.bamboo.util.BambooIterables

public final class BambooIterables
extends java.lang.Object


Method Summary
static
<T> java.lang.Iterable<T>
concat(java.lang.Iterable<? extends T> iterable, T object)
          Combines an iterable and an element into a single iterable.
static
<T,E extends java.lang.Throwable,F extends java.lang.Throwable>
T
find(java.lang.Iterable<T> iterable, DoubleThrowingPredicate<? super T,E,F> predicate, T defaultValue)
          Returns the first element in iterable that satisfies the given predicate, or defaultValue if none found.
static
<T> T
find(java.lang.Iterable<T> iterable, com.google.common.base.Predicate<? super T> predicate, java.lang.String exceptionMessage)
          Utility method to customize exception message thrown by Iterables.find(Iterable, com.google.common.base.Predicate).
static
<T,E extends java.lang.Throwable>
T
find(java.lang.Iterable<T> iterable, ThrowingPredicate<? super T,E> predicate, T defaultValue)
          Returns the first element in iterable that satisfies the given predicate, or defaultValue if none found.
<T> boolean
none(java.lang.Iterable<T> iterable, com.google.common.base.Predicate<? super T> predicate)
          Returns true if no elements in iterable fulfill predicate
static
<T> Pair<java.lang.Iterable<T>,java.lang.Iterable<T>>
split(java.util.List<T> unfiltered, com.google.common.base.Predicate<T> predicate)
          Splits iterable into a pair of two iterables, one fulfilling the predicate and one not fulfillling it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

find

@Nullable
public static <T,E extends java.lang.Throwable> T find(java.lang.Iterable<T> iterable,
                                                                ThrowingPredicate<? super T,E> predicate,
                                                                @Nullable
                                                                T defaultValue)
              throws E extends java.lang.Throwable
Returns the first element in iterable that satisfies the given predicate, or defaultValue if none found.

Throws:
E extends java.lang.Throwable

find

@Nullable
public static <T,E extends java.lang.Throwable,F extends java.lang.Throwable> T find(java.lang.Iterable<T> iterable,
                                                                                              DoubleThrowingPredicate<? super T,E,F> predicate,
                                                                                              @Nullable
                                                                                              T defaultValue)
              throws E extends java.lang.Throwable,
                     F extends java.lang.Throwable
Returns the first element in iterable that satisfies the given predicate, or defaultValue if none found.

Throws:
E extends java.lang.Throwable

none

public <T> boolean none(@NotNull
                        java.lang.Iterable<T> iterable,
                        @NotNull
                        com.google.common.base.Predicate<? super T> predicate)
Returns true if no elements in iterable fulfill predicate


find

public static <T> T find(java.lang.Iterable<T> iterable,
                         com.google.common.base.Predicate<? super T> predicate,
                         @Nullable
                         java.lang.String exceptionMessage)
Utility method to customize exception message thrown by Iterables.find(Iterable, com.google.common.base.Predicate).


concat

public static <T> java.lang.Iterable<T> concat(java.lang.Iterable<? extends T> iterable,
                                               T object)
Combines an iterable and an element into a single iterable. The returned iterable has an iterator that traverses the elements in a, followed by the elements in b. The source iterator is not polled until necessary. The returned iterable's iterator supports remove() when the corresponding input iterator supports it.


split

public static <T> Pair<java.lang.Iterable<T>,java.lang.Iterable<T>> split(java.util.List<T> unfiltered,
                                                                          com.google.common.base.Predicate<T> predicate)
Splits iterable into a pair of two iterables, one fulfilling the predicate and one not fulfillling it. The predicate will be run twice over the unfiltered list, so don't use this with large lists or slow predicates.

Parameters:
unfiltered -
predicate -
Returns:


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.