From b08748e620fd9ebab0c565b364c15fa412b5503b Mon Sep 17 00:00:00 2001 From: Robinson Date: Tue, 1 Aug 2023 20:26:17 -0600 Subject: [PATCH] code cleanup --- src/dorkbox/collections/Collections.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dorkbox/collections/Collections.kt b/src/dorkbox/collections/Collections.kt index f9698ff..f703f9e 100644 --- a/src/dorkbox/collections/Collections.kt +++ b/src/dorkbox/collections/Collections.kt @@ -36,7 +36,6 @@ object Collections { } /** Returns a random number between start (inclusive) and end (inclusive). */ - @JvmStatic fun random(start: Int, end: Int): Int { return start + random.nextInt(end - start + 1) } @@ -44,8 +43,16 @@ object Collections { /** * Returns the next power of two. Returns the specified value if the value is already a power of two. */ - @JvmStatic fun nextPowerOfTwo(value: Int): Int { return 1 shl 32 - Integer.numberOfLeadingZeros(value - 1) } + + /** + * When true, [Iterable.iterator] for [ObjectMap], and other collections will allocate a new + * iterator for each invocation. + * + * When false, the iterator is reused and nested use will throw an exception. Default is + * false. + */ + var allocateIterators = false }