package ru.dbotthepony.mc.otm.core.collect

import it.unimi.dsi.fastutil.ints.IntIterable
import it.unimi.dsi.fastutil.ints.IntIterator

fun IntRange.asIterable(): IntIterable {
	return IntIterable {
		val i = this@asIterable.iterator()

		object : IntIterator {
			override fun hasNext(): Boolean {
				return i.hasNext()
			}

			override fun remove() {
				throw UnsupportedOperationException()
			}

			override fun nextInt(): Int {
				return i.nextInt()
			}
		}
	}
}
