This file contains hidden or 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
interface Cat { | |
String mew() | |
} | |
class Zash implements Cat { | |
String mew(){ "雑種" } | |
} | |
class Nora implements Cat { | |
String mew(){ "野良" } | |
} | |
def scottish = [mew:{"すこてぃっしゅ"}] as Cat |
This file contains hidden or 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
class A { | |
def foo | |
} | |
def a = new A(foo: 'Foo') | |
assert a.foo == 'Foo' // プロパティアクセス(暗黙的) | |
assert a.getFoo() == 'Foo' // プロパティアクセス(明示的) | |
assert a.foo == 'Foo' // フィールドアクセス | |
assert a['foo'] == 'Foo' // マップアクセス | |
assert a.getAt('foo') == 'Foo' // マップアクセス(メソッド) |
This file contains hidden or 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
interface Cat { | |
String mew() | |
} | |
class Zash implements Cat { | |
String mew(){ "雑種" } | |
} | |
class Nora implements Cat { | |
String mew(){ "野良" } | |
} | |
def scottish = [mew:{"すこてぃっしゅ"}] as Cat |
This file contains hidden or 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.concurrent.ExecutorService | |
import java.util.concurrent.BlockingQueue | |
import java.util.concurrent.LinkedBlockingQueue | |
import java.util.concurrent.Executors | |
import java.util.concurrent.Callable | |
def executor = Executors.newSingleThreadExecutor() | |
// Closure as Interfaceパターン! | |
def future = executor.submit( { | |
def list = [] |
This file contains hidden or 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
package fumokmm.test.factory; | |
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
import static org.hamcrest.CoreMatchers.*; | |
public class FactoryTest { | |
static abstract class Alphabet { |