com.atlassian.jira.util.collect
Class CollectionEnclosedIterable<T>
java.lang.Object
com.atlassian.jira.util.collect.CollectionEnclosedIterable<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
- EnclosedIterable<T>, Sized
public class CollectionEnclosedIterable<T>
- extends Object
- implements EnclosedIterable<T>
Simple collection based EnclosedIterable
.
from
public static <T> EnclosedIterable<T> from(Collection<? extends T> collection)
- Create an
EnclosedIterable
from the supplied Collection. Does not copy the collection
so you should only use this if you are about to lose the reference or the collection is immutable.
- Type Parameters:
T
- the collection type- Parameters:
collection
-
- Returns:
copy
public static <T> EnclosedIterable<T> copy(Collection<? extends T> collection)
foreach
public void foreach(Consumer<T> sink)
- Description copied from interface:
EnclosedIterable
- Apply the sink to all elements in the Collection.
- Specified by:
foreach
in interface EnclosedIterable<T>
size
public int size()
- Specified by:
size
in interface EnclosedIterable<T>
- Specified by:
size
in interface Sized
- Returns:
- the likely size of the objects passed into the sink in
EnclosedIterable.foreach(Consumer)
. Be careful depending on this size
being exact, as in many cases its best efforts value or may be stable due to concurrent changes.
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface EnclosedIterable<T>
- Specified by:
isEmpty
in interface Sized
- Returns:
- true if the there is no data behind it.
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
Copyright © 2002-2012 Atlassian. All Rights Reserved.