Skip to content

Latest commit

 

History

History
53 lines (31 loc) · 962 Bytes

README.md

File metadata and controls

53 lines (31 loc) · 962 Bytes

sansyo

Build Status

This library is for Scala collections utility.
"sansyo(山椒)" means Japanese pepper.

How to Use

add Resolver and Dependency in build.sbt

resolvers += "sonatype releases" at "https://oss.sonatype.org/content/repositories/releases/"
libraryDependency += "com.github.moc-yuto"  %% "sansyo"               % "0.2.0"

Quick Start

filledOrElse

import com.github.mocyuto.SeqUtils._

val seq = Seq(1,2,3)
val emptySeq = Seq()

seq.filledOrElse(Seq(0)) // Seq(1,2,3)
emptySeq.filledOrElse(Seq(0)) // Seq(0)

partitionMap

import com.github.mocyuto.SeqUtils._

val seq = Seq(1,2,3)

seq.partitionMap(_ > 1)(a => a + 1) // (Seq(3, 4), Seq(2))

grouping

import com.github.mocyuto.MapUtils._

val seq = Seq((1,2),(2, 3),(1,3))

seq.grouping() // Map(2 -> Seq(3), 1 -> Seq(2, 3))