Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7beb9c4

Browse files
committed
Add New.java
1 parent 063f89f commit 7beb9c4

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

com/elephant/util/New.class

1.15 KB
Binary file not shown.

com/elephant/util/New.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.elephant.util;
2+
import java.util.*;
3+
4+
public class New{
5+
public static <K,V> Map<K,V> map(){
6+
return new HashMap<K,V>();
7+
}
8+
public static <T> List<T> list(){
9+
return new ArrayList<T>();
10+
}
11+
public static <T> LinkedList<T> lList(){
12+
return new LinkedList<T>();
13+
}
14+
public static <T> Set<T> set(){
15+
return new HashSet<T>();
16+
}
17+
public static <T> Queue<T> queue(){
18+
return new LinkedList<T>();
19+
}
20+
21+
public static void main(String[] args){
22+
Map<String,List<String>> msl=New.map();
23+
List<String> ls=New.list();
24+
LinkedList<String> lls=New.lList();
25+
Set<String> ss=New.set();
26+
Queue<String> qs=New.queue();
27+
}
28+
}

0 commit comments

Comments
 (0)