Java Tutorial/Collections/Prebuilt Collections
Версия от 17:44, 31 мая 2010; (обсуждение)
Empty Collections
The Collections class provides three constants to represent empty collections
public static final List EMPTY_LIST
public static final Map EMPTY_MAP
public static final Set EMPTY_SET
Singleton Collections
import java.util.Collections;
public class MainClass{
public static void main(String[] a){
System.out.println(Collections.singletonList("a"));
System.out.println(Collections.singleton("a"));
System.out.println(Collections.singletonMap("a","b"));
}
}
[a] [a] {a=b}