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 seqtest; | |
//メイン処理。 | |
public class Main { | |
private static final int TASK_COUNT = 1000000; | |
public static void main(String[] argv) { | |
// 非同期タスクたちを順番に実行させる。 | |
SequentialAsyncTask[] tasks = new SequentialAsyncTask[TASK_COUNT]; |
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 BinaryStringPrinter { | |
public static void print(byte value) { | |
System.out.println(zeroPadding(8, Integer.toBinaryString(value))); | |
} | |
public static void print(short value) { | |
System.out.println(zeroPadding(16, Integer.toBinaryString(value))); | |
} |
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
String.metaClass.destructiveReverse << { | |
def chars = delegate.value; | |
chars.eachWithIndex {e, i -> | |
chars[- i - 1] = e | |
} | |
} | |
def s = 'groovy' | |
s.destructiveReverse() | |
assert s == 'yvoorg' |
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 com.github.ryoasai; | |
import java.util.Date; | |
import javax.validation.constraints.NotNull; | |
import javax.validation.constraints.Size; | |
import org.joda.time.DateMidnight; | |
import org.springframework.format.annotation.DateTimeFormat; |
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 com.github.ryoasai; | |
import static org.hamcrest.CoreMatchers.*; | |
import static org.junit.Assert.*; | |
import java.util.List; | |
import org.hamcrest.Matcher; | |
import org.junit.Test; | |
import org.springframework.beans.BeanWrapper; |
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.lang.reflect.*; | |
public class Outer { | |
private String outer = "outer"; | |
public class Inner { | |
public void hello() { | |
System.out.println("Hello World" + outer); // NullPointerException at this line. | |
} |
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 com.github.ryoasai; | |
import static org.hamcrest.CoreMatchers.*; | |
import static org.junit.Assert.*; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.HashMap; | |
import java.util.List; |
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.ArrayList; | |
import java.util.List; | |
/** | |
* <p>Demonstrating why the Object.getClass() method's return type should be | |
* Class<? extends |T|> but not Class<? extends T>, where |T| is the erasure | |
* of the static type T. </p> | |
* <p> | |
* Type parameter of every Class instance should always be reifiable type | |
* or wildcard type with reifiable upper bound. |
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 static org.junit.Assert.*; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.GenericArrayType; | |
import java.lang.reflect.ParameterizedType; | |
import java.lang.reflect.Type; | |
import java.lang.reflect.TypeVariable; | |
import java.lang.reflect.WildcardType; | |
import java.util.List; |
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.lang.reflect.Field; | |
import java.lang.reflect.GenericArrayType; | |
import java.lang.reflect.ParameterizedType; | |
import java.lang.reflect.Type; | |
import java.util.List; | |
public class GenericTypeSample { | |
public List<Integer>[] testField; | |
public static void main(String[] args) throws Exception { |
NewerOlder