summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/collection/SetLike.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala
index 7990837685..71c12be778 100644
--- a/src/library/scala/collection/SetLike.scala
+++ b/src/library/scala/collection/SetLike.scala
@@ -212,12 +212,13 @@ self =>
def subsetOf(that: Set[A]) = this forall that
/** An iterator over all subsets of this set of the given size.
+ * If the requested size is impossible, an empty iterator is returned.
*
* @param len the size of the subsets.
* @return the iterator.
*/
def subsets(len: Int): Iterator[This] = {
- if (len < 0 || len > size) throw new IllegalArgumentException(len.toString)
+ if (len < 0 || len > size) Iterator.empty
else new SubsetsItr(self.toIndexedSeq, len)
}