Created
March 12, 2016 12:27
-
-
Save keitaroemotion/29484029762e0f3f902e to your computer and use it in GitHub Desktop.
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.*; | |
| public class Main{ | |
| public static void main(String args[]){ | |
| puts(get(push(toList(args), "aaa"), 0)); | |
| immutableListTest(args); | |
| } | |
| private static <T> void immutableListTest(String args[]){ | |
| List<String> immutableList = toList(args); | |
| immutableList = push(immutableList, "hahaha"); | |
| for(String t: immutableList) | |
| puts(t); | |
| } | |
| public static <T> List<T> toList(T[] args){ | |
| return Arrays.asList(args); | |
| } | |
| public static <T> List<T> push(List<T> list, T elem){ | |
| List<T> _list = new ArrayList<T>(); | |
| for(T t : list) | |
| _list.add(t); | |
| return _list; | |
| } | |
| public static <T> T get(List<T> list, Integer i){ | |
| return list.get(i); | |
| } | |
| public static <T> void puts(T text){ | |
| System.out.println(text); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment