Package it.unimi.di.prog2.s19
Class IteratorUtils
java.lang.Object
it.unimi.di.prog2.s19.IteratorUtils
Utility methods for iterators.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
IteratorUtils
private IteratorUtils().
-
-
Method Details
-
concatenate
Concatenates two iterators.- Type Parameters:
T
- the type of the elements in the iterators.- Parameters:
a
- the first iterator.b
- the second iterator.- Returns:
- an iterator that first returns all elements of
a
and then all elements ofb
. - Throws:
NullPointerException
- ifa
orb
isnull
.
-
emptyIterator
An empty iterator.- Type Parameters:
T
- the type of the elements in the iterator.- Returns:
- the iterator.
-
join
Joins the elements of an iterator using a separator.- Type Parameters:
T
- the type of the elements in the iterator.- Parameters:
iterator
- the iterator.separator
- the separator.- Returns:
- the string obtained by concatenating the string representation of the elements of the iterator, separated by the separator.
- Throws:
NullPointerException
- ifiterator
orseparator
isnull
.
-