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.*; | |
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); | |
} | |
} | |
No comments:
Post a Comment