stacycurl / pimpathon Goto Github PK
View Code? Open in Web Editor NEWAdds useful methods to scala & java classes.
License: Apache License 2.0
Adds useful methods to scala & java classes.
License: Apache License 2.0
valueForMaxKey, valueForMinKey, keyForMaxValue, keyForMinValue
def select(chooseValue: List[V] => V): Map[K, V]
with some of the functionality from Shared.
def applyAll(fns: (T ⇒ T)*): T = Function.chain(fns)(value)
def partitionBy[C](pf: PartialFunction[K, C]): (Map[C, V], Map[K, V])
pf: PartialFunction[K, C]
// Have to use map.get because even though we can safely call map.apply when sorting the map, the ordering is ALSO
// used to implement 'contains'
def sortByValues(implicit ordering: Ordering[V]): SortedMap[K, V] = sorted(Ordering.OptionV.on(map.get))
def andThenM[W](other: Map[V, W]): Map[K, W]
def ***[C, D](pf2: PartialFunction[C, D]): PartialFunction[(A, C), (B, D)]
def filterKeysNot(f: K ⇒ Boolean): Map[K, V]
def filterValues(f: V ⇒ Boolean): Map[K, V]
def getMany(keys: List[K]): (List[V], List[K])
def compareTo(other : T)(implicit ev : Ordering[T]) = ev.compare(value, other)
Some notes on how we setup a nice workflow in ENSIME:
You'll need to temporarily comment out lines 4 and 5 of the travis config (enabling CI on other branches) until you have created those branches.
& maintain order
I often find myself wanting to use this pattern:
option.getOrElse(throw new IllegalArgumentException("some meaningful message"))
it would be great to be able to do
option.getOrThrow("some meaningful message")
perhaps with a String => Throwable
curried parameter to allow users to change the kind of exception that is thrown (IAE default)
def tap[LV, RV](left: L => LV, right: R => RV): Either[L, R] = { either.fold(left, right); either }
(sorry, 2.9 is a bitch, especially 2.9.2)
emptyTo, prefixWith, suffixWith, removePrefix, removeSuffix
def ifSome: (Option[A]) ⇒ Boolean = (oa: Option[A]) ⇒ oa.fold(a ⇒ (f(a), false)
def collectKeys[C](pf: PartialFunction[K, C]): Map[C, V]
def collectKeysO[C](f: K ⇒ Option[C]): Map[C, V]
these would be great.
Even better if convenience methods for creating File
could be on the RichFile
object itself and not a separate FileUtils
.
def collectValues[W](pf: PartialFunction[V, W]): Map[K, W]
def collectValuesO[W](f: V ⇒ Option[W]): Map[K, W]
def sortKeysBy[S](f: K ⇒ S)(implicit ordering: Ordering[S]): SortedMap[K, V]
className[A: ClassTag]: String
simpleClassName[A: ClassTag]: String
klassOf[A: ClassTag]: Class[A]
def sorted(implicit ordering: Ordering[K]): SortedMap[K, V]
def reverse(chooseKey: Set[K] => K): Map[V, K]
in a shapeless-stylee it would be great if everything started with pimpathon
instead of the longer stacycurl.scala.pimpathon
def prefixPadTo(len: Int, elem: A): List[A]
often called update
, I find an explicit name is much easier to understand.
def map[LV, RV](left: L => LV, right: R => RV): Either[LV, RV] = either.fold(l => Left(left(l)), r => Right(right(r)))
def fraction(pred: A ⇒ Boolean): Double
def attributeCounts[B](f: A => B): Map[B, Int]
def optAttributeCounts[B](f: A => Option[B]): Map[B, Int]
def collectAttributeCounts[B](pf: PartialFunction[A, B]): Map[B, Int]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.