Skip to content

Commit 8332f67

Browse files
miselicophimuemue
authored andcommitted
Made explicit that duplicates are preserved. Also changed the example such that there are duplicates. Added a comments to indicate what the content of the three input iterators is.
1 parent ecda88e commit 8332f67

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ pub trait Itertools: Iterator {
13041304
}
13051305

13061306
/// Return an iterator adaptor that flattens an iterator of iterators by
1307-
/// merging them in ascending order.
1307+
/// merging them in ascending order. Duplicates are preserved.
13081308
///
13091309
/// If all base iterators are sorted (ascending), the result is sorted.
13101310
///
@@ -1313,11 +1313,12 @@ pub trait Itertools: Iterator {
13131313
/// ```
13141314
/// use itertools::Itertools;
13151315
///
1316-
/// let a = (0..6).step_by(3);
1317-
/// let b = (1..6).step_by(3);
1318-
/// let c = (2..6).step_by(3);
1316+
/// let a = (0..6).step_by(3); // [0, 3]
1317+
/// let b = (1..6).step_by(2); // [1, 3, 5 ]
1318+
/// let c = (2..6).step_by(3); // [2, 5]
1319+
///
13191320
/// let it = vec![a, b, c].into_iter().kmerge();
1320-
/// itertools::assert_equal(it, vec![0, 1, 2, 3, 4, 5]);
1321+
/// itertools::assert_equal(it, vec![0, 1, 2, 3, 3, 5, 5]);
13211322
/// ```
13221323
#[cfg(feature = "use_alloc")]
13231324
fn kmerge(self) -> KMerge<<Self::Item as IntoIterator>::IntoIter>

0 commit comments

Comments
 (0)