Skip to content

Instantly share code, notes, and snippets.


afz aamirfayaz

View GitHub Profile
View Tree.scala
* D Holbrook
* Code Club: PO1
* (*) Define a binary tree data structure and related fundamental operations.
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported:
* Constructors
View customEventBusExample.scala
import akka.event.{LookupClassification, EventBus}
import akka.event.ActorEventBus
case class Book(title: String, authors: List[String])
class AuthorBookBus(author: String) extends EventBus
with LookupClassification
with ActorEventBus {
View eventStreamExample.scala
case class Book(title: String, authors: List[String])
class BookPublisher extends Actor {
def receive = {
case book: Book => {
println(s"Yeah! Publishing a new book: $book")
aamirfayaz / GenericsStart
Created Mar 21, 2017
Simple Generic Start In Scala
View GenericsStart
package generics
object TestProb1 extends App {
//type constraints
class D[T <: B] // T must be a B. i.e. for any T, it is a B or a subclass of B.
new D[B]()
new D[C]()
//new D[A]() CTE (type arguments [generics.A] do not conform to class D's type parameter bounds [T <: generics.B]
View alternative, using regex
val pattern = java.util.regex.Pattern.compile ("""(?xs) ("(.*?)"|) ; ("(.*?)"|) (?: \r?\n | \z ) """)
val matcher = pattern.matcher (input)
while (matcher.find) {
val col1 = (2)
val col2 = (4)
// ...
You can’t perform that action at this time.