This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2013 midgardabc.com | |
*/ | |
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.util.Random; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Birds { | |
static int numberOfBirdTypes = 0; | |
static String[][] birds = new String[numberOfBirdTypes][4]; | |
public static void main(String[] args) { | |
printBirdInfo(); // array is empty | |
addBirdType("Eagle"); // initializing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Doubles { | |
public Double parse(String s) { | |
if (isNumber(s)) { | |
return Double.valueOf(s); | |
} else { | |
return null; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Collection; | |
import java.util.Iterator; | |
public class Main { | |
interface A {} | |
class B { | |
void add(A... a) {} | |
void add(Collection<A> c) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ val Circle = "S" :: Type | |
Circle: Typ[Term] with Subs[Typ[Term]] = S : 𝒰 _0 | |
@ val base = "base" :: Circle | |
base: Term with Subs[Term] = base : (S : 𝒰 _0) | |
@ val loop = "loop" :: (base =:= base) | |
loop: Term with Subs[Term] = loop : (base : (S : 𝒰 _0) = base : (S : 𝒰 _0)) | |
@ val X = "X" :: Type | |
X: Typ[Term] with Subs[Typ[Term]] = X : 𝒰 _0 | |
@ val a = "a" :: X | |
a: Term with Subs[Term] = a : (X : 𝒰 _0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Search { | |
type T | |
} | |
trait WriterSearch extends Search { | |
override type T <: Writer | |
} | |
trait BookSearch extends Search { | |
override type T <: Book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object App { | |
trait Subtype[A, B] { | |
type C <: B | |
def apply(ev: A <:< B): (C =:= A, A =:= C) | |
} | |
object Subtype { | |
type Aux[A, B, C0 <: B] = Subtype[A, B] { type C = C0 } | |
def instance[A, B, C0 <: B](f: A <:< B => (C0 =:= A, A =:= C0)): Aux[A, B, C0] = new Subtype[A, B] { | |
override type C = C0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapeless.{::, HNil, Poly1, poly} | |
object App { | |
implicit object p extends Poly1 { | |
implicit val cse: Case.Aux[Int, String] = at(_.toString) | |
} | |
// implicit val p = new Poly1 { | |
// implicit val cse: Case.Aux[Int, String] = at(_.toString) | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object App { | |
trait MyTrait | |
object MyTrait { | |
def materialize[A <: MyTrait](implicit m: A): A = m | |
} | |
implicit val m/*: MyTrait*/ /*: (MyTrait { | |
/*implicit*/ val x: Int | |
})*/ = new MyTrait { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Macros._ | |
object App { | |
class A | |
class A1 | |
class A2 | |
class A3 | |
@checkImplicits | |
def foo(implicit a: A = new A, a1: A1 = new A1, a2: A2 = new A2, a3: A3 = new A3): Unit = () |
OlderNewer