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.io.IOException; | |
public class NewInstanceInClass { | |
public NewInstanceInClass() throws Throwable { | |
// チェック例外を送出する。 | |
throw new IOException(); | |
} | |
public static void main(String[] args) { |
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.io.IOException; | |
import java.lang.reflect.Constructor; | |
import java.lang.reflect.InvocationTargetException; | |
public class NewInstanceInConstructor { | |
public NewInstanceInConstructor() throws Throwable { | |
// チェック例外を送出する。 | |
throw new IOException(); | |
} |
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 | |
fun IntRange.fizzBuzz() = this.map { | |
when (#(it % 3, it % 5)) { | |
is #(0, 0) -> "fizzbuzz" | |
is #(0, *) -> "fizz" | |
is #(*, 0) -> "buzz" | |
else -> "" | |
} | |
} |
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
apply plugin: 'java' | |
defaultTasks 'build' | |
sourceSets { | |
main { | |
java { | |
srcDir 'main/java' | |
} | |
} |
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
fun main(args: Array<String>) { | |
println (30.buzzbuzz().toList()) | |
} | |
fun Int.buzzbuzz(): java.util.Iterator<Int> { | |
var buzz = #(0, 0) | |
fun Int.range(size:Int) = (this + 1 .. this + size) | |
fun buzzer() = { | |
if (buzz._1 >= this) { | |
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
class Buzz implements Comparable<Buzz> { | |
private int index | |
private Buzz(int index) { | |
this.index = index | |
} | |
def static start(int index) { | |
while (!isBuzz(index)) {index++} |
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
package siosio.validator | |
import org.codehaus.groovy.grails.validation.AbstractConstraint | |
import org.springframework.validation.Errors | |
class NumCharValidator extends AbstractConstraint { | |
public static final NAME = "number" | |
private static final String DEFAULT_MESSAGE = "default.invalid.number.message" |
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
class Hogehoge { | |
def cls = {} | |
static hogefuga = {} | |
} | |
cls = {} | |
def cls2 = {} | |
def method(Closure c) { | |
println getDeclaredName(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
select case | |
when mod(seq.col1, 3) = 0 and mod(seq.col1, 5) = 0 then | |
'fizzbuzz' | |
when mod(seq.col1, 3) = 0 then | |
'fizz' | |
when mod(seq.col1, 5) = 0 then | |
'buzz' | |
else | |
to_char(seq.col1) | |
end fizzbuzz |
OlderNewer