// Create an array containing the elements in a list
Object[] objectArray = list.toArray();
MyClass[] array = (MyClass[]) list.toArray(new MyClass[list.size()]);
// Create an array containing the elements in a set
objectArray = set.toArray();
array = (MyClass[]) set.toArray(new MyClass[set.size()]);
// Create an array containing the keys in a map
objectArray = map.keySet().toArray();
array = (MyClass[]) map.keySet().toArray(new MyClass[set.size()]);
// Create an array containing the values in a map
objectArray = map.values().toArray();
array = (MyClass[]) map.values().toArray(new MyClass[set.size()]);
分享到:
相关推荐
Adding an Entry to a Dictionary Recipe 4.11. Building a Dictionary Without Excessive Quoting Recipe 4.12. Building a Dict from a List of Alternating Keys and Values Recipe 4.13. Extracting a ...
1.4 Adding an Entry to a Dictionary 1.5 Associating Multiple Values with Each Key in a Dictionary 1.6 Dispatching Using a Dictionary 1.7 Collecting a Bunch of Named Items 1.8 Finding the ...
Value arrays - A container structure to maintain an array of generic values III. Tools Reference glib-mkenums - C language enum description generation utility glib-genmarshal - C code marshaller ...
Copy the file with .scr extension to your computers win directory (Windows for 98, Winnt for NT) and check in screens saver settings.<END><br>73,Cls_sample_Collection.zip Implement with Class and ...
Exercise 7.2 Adding a Menu to a Form at Design Time 323 Creating Dialog Boxes 1.Create a form. 2.Set the BorderStyle property of the form to FixedDialog. 3.Set the ControlBox, MinimizeBox, and ...
E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a ; previously set variable or directive (e.g. ${foo}) ; Expressions in the INI file are limited to bitwise operators and parentheses: ...
Converting XML to ADO.NET Data 820 Reading and Writing a DiffGram 822 Serializing Objects in XML 825 Serialization without Source Code Access 833 Summary 836 Chapter 24: Working with Active Directory ...
Array initialization ............. 133 Variable argument lists ............. 137 Enumerated types ............... 141 Summary ............................ 143 Access Control 145 package: the library ...
PEP 372: Adding an Ordered Dictionary to collections PEP 378: Format Specifier for Thousands Separator PEP 389: The argparse Module for Parsing Command Lines PEP 391: Dictionary-Based Configuration...
1.4.1 HardwareOrganization of aSystem . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.4.2 Running the helloProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.5 CachesMatter ...