Last active
December 17, 2015 11:49
-
-
Save YukiYoshikawa/5604687 to your computer and use it in GitHub Desktop.
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 trial.yy.lombok.client; | |
import static java.lang.System.out; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import lombok.val; | |
/** | |
* Created with Eclipse. | |
* User: yy | |
*/ | |
public class LombokClient2 { | |
public static void main(String[] args) { | |
// 通常のArrayListの生成(java6の場合) | |
final ArrayList<String> listNormal = new ArrayList<String>(); | |
listNormal.add("Hello, World 1!"); | |
listNormal.add("Hello, World 2!"); | |
out.println("listNormal: " + listNormal); | |
// lombok.valを使用したArrayListの生成(左辺の型の記述を省略できる) | |
val listVal = new ArrayList<String>(); | |
listVal.add("Hello, World A!"); | |
listVal.add("Hello, World B!"); | |
out.println("listVal: " + listVal); | |
// 通常のHashMapの生成(java6の場合) | |
final HashMap<Integer, String> mapNormal = new HashMap<Integer, String>(); | |
mapNormal.put(1, "name-1"); | |
mapNormal.put(2, "name-2"); | |
out.println("mapNormal: " + mapNormal); | |
// lombok.valを使用したHashMapの生成(左辺の型の記述を省略できる) | |
val mapVal = new HashMap<Integer, String>(); | |
mapVal.put(1, "name-A"); | |
mapVal.put(2, "name-B"); | |
out.println("mapVal: " + mapVal); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment