com.atlassian.jira.util.collect
Interface CloseableIterable

All Superinterfaces:
Sized
All Known Implementing Classes:
DatabaseIterable, DecoratingIterable, PagedDatabaseIterable, SharedEntitySearchResult

public interface CloseableIterable
extends Sized

A limited collection view that may be backed by the something that needs closing, for example a connection to a database. All iterators returned from iterator() must be closed after use in a finally block.

Since:
v3.13

Nested Class Summary
static class CloseableIterable.ListResolver
          Utility class for transforming a CloseableIterable into a List.
 
Method Summary
 boolean isEmpty()
           
 CloseableIterator iterator()
           
 int size()
           
 

Method Detail

iterator

CloseableIterator iterator()
Returns:
a CloseableIterator that can be closed once finished with

size

int size()
Specified by:
size in interface Sized
Returns:
the likely size of the objects returned by the iterator(). 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

boolean isEmpty()
Returns:
true if the there is no data behind it. In this case the iterator().hasNext() will return false;


Copyright © 2002-2009 Atlassian. All Rights Reserved.