public class Iterators extends Object
Collections.| Constructor and Description | 
|---|
| Iterators() | 
| Modifier and Type | Method and Description | 
|---|---|
| static <E,C extends Collection<E>> | addAll(Iterator<? extends E> iter,
      C collection)Adds all elements from the supplied iterator to the specified collection. | 
| static <E> List<E> | asList(Iterator<? extends E> iter)Get a List containing all elements obtained from the specified iterator. | 
| static void | close(Iterator<?> iter)Closes the given iterator if it implements  Closeableelse do nothing. | 
| static void | closeSilently(Iterator<?> iter)Closes the given iterator, swallowing any IOExceptions, if it implements  Closeableelse do
 nothing. | 
| 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. | 
| 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. | 
public static <E> List<E> asList(Iterator<? extends E> iter)
iter - the iterator to get the elements frompublic static <E,C extends Collection<E>> C addAll(Iterator<? extends E> iter, C collection)
iter - An iterator containing elements to add to the container.collection - The collection to add the elements to.public static String toString(Iterator<?> iter, String separator)
iter - An iterator over arbitrary objects that are expected to implement Object.toString().separator - The separator to insert between the object strings.public static void toString(Iterator<?> iter, String separator, StringBuilder sb)
iter - An iterator over arbitrary objects that are expected to implement Object.toString().separator - The separator to insert between the object strings.sb - A StringBuilder to append the iterator string to.public static void close(Iterator<?> iter) throws IOException
Closeable else do nothing.iter - The iterator to close.IOException - If an underlying I/O error occurs.Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.