com.atlassian.jira.util.collect
Class CollectionEnclosedIterable<T>

java.lang.Object
  extended by com.atlassian.jira.util.collect.CollectionEnclosedIterable<T>
Type Parameters:
T -
All Implemented Interfaces:
EnclosedIterable<T>, Sized

public class CollectionEnclosedIterable<T>
extends java.lang.Object
implements EnclosedIterable<T>

Simple collection based EnclosedIterable.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.collect.EnclosedIterable
EnclosedIterable.Functions, EnclosedIterable.ListResolver<T>
 
Method Summary
static
<T> EnclosedIterable<T>
copy(java.util.Collection<? extends T> collection)
           
 boolean equals(java.lang.Object obj)
           
 void foreach(Consumer<T> sink)
          Apply the sink to all elements in the Collection.
static
<T> EnclosedIterable<T>
from(java.util.Collection<? extends T> collection)
          Create an EnclosedIterable from the supplied Collection.
 int hashCode()
           
 boolean isEmpty()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

from

public static <T> EnclosedIterable<T> from(java.util.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(java.util.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(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2002-2010 Atlassian. All Rights Reserved.