| java.lang.Object org.ontoware.rdf2go.util.Iterators
Iterators | public class Iterators (Code) | | This class consists exclusively of static methods that operate on or return
iterators. It is the Iterator-equivalent of java.util.Collections.
copied into RDF2Go by Leo Sauemann on 11.1.2007,
it helps to get working quicker.
|
Method Summary | |
public static C | addAll(Iterator<? extends E> iter, C collection) Adds all elements from the supplied iterator to the specified collection. | public static void | closeCloseable(Iterator> iter) Closes the supplied iterator if it is an instance of
CloseableIterator , otherwise the request is ignored. | public static int | count(Iterator> it) Runs through the iterator and returns number of items. | public static String | toString(Iterator> iter, String separator) Converts an iterator to a string by concatenating all of the string
representations of objects in the iterator, divided by a separator.
Parameters: iter - An iterator over arbitrary objects that are expected to implementObject.toString. Parameters: separator - The separator to insert between the object strings. | public static void | toString(Iterator> iter, String separator, StringBuilder sb) Converts an iterator to a string by concatenating all of the string
representations of objects in the iterator, divided by a separator. |
addAll | public static C addAll(Iterator<? extends E> iter, C collection)(Code) | | Adds all elements from the supplied iterator to the specified collection. If the
supplied iterator is an instance of
CloseableIterator it is automatically
closed after consumption.
Parameters: iter - An iterator containing elements to add to the container. If the iteratoris an instance of CloseableIterator it is automatically closedafter consumption. Parameters: collection - The collection to add the elements to. The collection object that was supplied to this method. |
closeCloseable | public static void closeCloseable(Iterator> iter)(Code) | | Closes the supplied iterator if it is an instance of
CloseableIterator , otherwise the request is ignored.
Parameters: iter - The iterator that should be closed. |
count | public static int count(Iterator> it)(Code) | | Runs through the iterator and returns number of items. It doesn't close it.
author: clemente Parameters: it - Any type of iterator, not null |
toString | public static String toString(Iterator> iter, String separator)(Code) | | Converts an iterator to a string by concatenating all of the string
representations of objects in the iterator, divided by a separator.
Parameters: iter - An iterator over arbitrary objects that are expected to implementObject.toString. Parameters: separator - The separator to insert between the object strings. A String representation of the objects provided by the suppliediterator. |
toString | public static void toString(Iterator> iter, String separator, StringBuilder sb)(Code) | | Converts an iterator to a string by concatenating all of the string
representations of objects in the iterator, divided by a separator.
Parameters: iter - An iterator over arbitrary objects that are expected to implementObject.toString. Parameters: separator - The separator to insert between the object strings. Parameters: sb - A StringBuilder to append the iterator string to. |
|
|