scala-collection-compat icon indicating copy to clipboard operation
scala-collection-compat copied to clipboard

add *inPlace compatibility for 2.12.

Open MasseGuillaume opened this issue 6 years ago • 3 comments

for example: mutable.Set.filterInPlace

MasseGuillaume avatar Jul 10 '18 08:07 MasseGuillaume

  • [x] library/scala/collection/ArrayOps.scala:

    • [x] def mapInPlace(f: A => A): Array[A]
  • [ ] library/scala/collection/mutable/Buffer.scala:

    • [ ] def patchInPlace(from: Int, patch: scala.collection.Seq[A], replaced: Int): this.type
    • [ ] def dropInPlace(n: Int): this.type
    • [ ] def dropRightInPlace(n: Int): this.type
    • [ ] def takeInPlace(n: Int): this.type
    • [ ] def takeRightInPlace(n: Int): this.type
    • [ ] def sliceInPlace(start: Int, end: Int): this.type
    • [ ] def dropWhileInPlace(p: A => Boolean): this.type
    • [ ] def takeWhileInPlace(p: A => Boolean): this.type
    • [ ] def padToInPlace(len: Int, elem: A): this.type
    • [ ] def flatMapInPlace(f: A => IterableOnce[A]): this.type
    • [ ] def filterInPlace(p: A => Boolean): this.type
    • [ ] def patchInPlace(from: Int, patch: scala.collection.Seq[A], replaced: Int): this.type
  • [ ] library/scala/collection/mutable/IndexedSeq.scala:

    • [ ] def mapInPlace(f: A => A): this.type
  • [ ] library/scala/collection/mutable/ListBuffer.scala:

    • [ ] def mapInPlace(f: A => A): this.type
    • [ ] def flatMapInPlace(f: A => IterableOnce[A]): this.type
    • [ ] def filterInPlace(p: A => Boolean): this.type
    • [ ] def patchInPlace(from: Int, patch: collection.Seq[A], replaced: Int): this.type
  • [ ] library/scala/collection/mutable/Map.scala:

    • [ ] @deprecated("Use filterInPlace instead", "2.13.0") def retain(p: (K, V) => Boolean): this.type = filterInPlace(p)
    • [ ] def filterInPlace(p: (K, V) => Boolean): this.type
    • [ ] @deprecated("Use mapValuesInPlace instead", "2.13.0") def transform(f: (K, V) => V): this.type = mapValuesInPlace(f)
    • [ ] def mapValuesInPlace(f: (K, V) => V): this.type
  • [ ] library/scala/collection/mutable/OpenHashMap.scala:

    • [ ] def mapValuesInPlace(f : (Key, Value) => Value): this.type
    • [ ] def filterInPlace(f : (Key, Value) => Boolean): this.type
  • [ ] library/scala/collection/mutable/PriorityQueue.scala:

    • [ ] def mapInPlace(f: A => A): this.type
  • [ ] library/scala/collection/mutable/Seq.scala:

    • [ ] @deprecated("Use mapInPlaceon anIndexedSeq instead", "2.13.0") @inline final def transform(f: A => A): this.type
  • [ ] library/scala/collection/mutable/Set.scala:

    • [ ] @deprecated("Use filterInPlace instead", "2.13.0") def retain(p: A => Boolean): Unit = filterInPlace(p)
    • [ ] def filterInPlace(p: A => Boolean): this.type
  • [ ] library/scala/collection/mutable/StringBuilder.scala:

    • [ ] @deprecated("Use reverseInPlace instead", "2.13.0") final def reverseContents(): this.type = reverseInPlace()
    • [ ] def reverseInPlace(): this.type
  • [ ] library/scala/collection/mutable/UnrolledBuffer.scala:

    • [ ] def mapInPlace(f: T => T): this.type
    • [ ] def patchInPlace(from: Int, patch: scala.collection.Seq[T], replaced: Int): this.type

Blocked:

  • [ ] library/scala/collection/convert/Wrappers.scala: (https://github.com/scala/bug/issues/11092)

    • [ ] def flatMapInPlace(f: A => scala.collection.IterableOnce[A]): this.type
    • [ ] def patchInPlace(from: Int, patch: scala.collection.Seq[A], replaced: Int): this.type
    • [ ] def filterInPlace(p: A => Boolean): this.type
    • [ ] def mapInPlace(f: A => A): this.type
  • [ ] library/scala/collection/mutable/ArrayBuffer.scala:

    • [ ] def sortInPlace[B >: A]()(implicit ord: Ordering[B]): this.type (2.13.0-M5)
  • [ ] library/scala/collection/mutable/ArraySeq.scala:

    • [ ] def sortInPlace[B >: T]()(implicit ord: Ordering[B]): this.type (2.13.0-M5)
  • [ ] library/scala/collection/mutable/IndexedSeq.scala:

    • [ ] def sortInPlace[B >: A]()(implicit ord: Ordering[B]): this.type (2.13.0-M5)
    • [ ] def sortInPlaceWith(lt: (A, A) => Boolean): this.type (2.13.0-M5)
    • [ ] def sortInPlaceBy[B](f: A => B)(implicit ord: Ordering[B]): this.type (2.13.0-M5)

MasseGuillaume avatar Aug 20 '18 10:08 MasseGuillaume

These methods would be very extremely useful!

leleogere avatar Jul 13 '22 06:07 leleogere

I've labeled this as "good first issue" because these can be added one at a time — a PR that only added some of them would still be mergeable.

SethTisue avatar Oct 28 '22 14:10 SethTisue