<commit_before>package io.reactors
package common



import scala.collection._
import scala.reflect.ClassTag



/** A collection that is a set and a sequence, simultaneously.
 */
class IndexedSet[T >: Null <: AnyRef] {
  private val buffer = mutable.ArrayBuffer[T]()
  private val index = mutable.Map[T, Int]()

  def size = buffer.size

  def length = size

  def apply(i: Int) = buffer(i)

  def +=(x: T) = if (!index.contains(x)) {
    buffer += x
    index(x) = buffer.length - 1
  }

  def -=(x: T) = if (index.contains(x)) {
    val idx = index(x)
    val last = buffer.last
    buffer(idx) = last
    buffer.remove(buffer.length - 1)
    index(last) = idx
  }
}<commit_msg>Fix return types in indexed set.<commit_after>package io.reactors
package common



import scala.collection._
import scala.reflect.ClassTag



/** A collection that is a set and a sequence.
 */
class IndexedSet[T >: Null <: AnyRef] extends Seq[T] {
  private val buffer = mutable.ArrayBuffer[T]()
  private val index = mutable.Map[T, Int]()

  def length = buffer.size

  def apply(i: Int) = buffer(i)

  def iterator = buffer.iterator

  def +=(x: T): this.type = {
    if (!index.contains(x)) {
      buffer += x
      index(x) = buffer.length - 1
    }
    this
  }

  def -=(x: T): this.type = {
    if (index.contains(x)) {
      val idx = index(x)
      val last = buffer.last
      buffer(idx) = last
      buffer.remove(buffer.length - 1)
      index(last) = idx
    }
    this
  }
}
{'fraction_non_alphanumeric': 0.13664174031271245, 'fraction_numerical': 0.002719238613188307, 'mean_word_length': 2.707808564231738, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7150876', 'n_tokens_mistral': 525, 'n_tokens_neox': 500, 'n_words': 146}