// 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 ...
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 ...
- The structure uses a dynamic array to store the pixel data, allowing for efficient memory management and access. ##### 2. `CImgList<T>` **Structure Overview:** - `CImgList<T>` is a container class...
- **Type Casting**: Converting one type to another, including upcasting and downcasting. - **Array Assignments**: Creating and initializing arrays, including multi-dimensional arrays. #### 4. ...
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 ...
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 ...