Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

convert hashset to array

//	First of all, you shouldn't use raw types.
//	Use :
	Set<Integer> set = new HashSet<>();
	set.add(4);
	set.add(1);
//	Then convert to array :
	Integer[] arr = x.toArray(new Integer[set.size()]);
//	Using x.toArray() would give you an Object[].
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #hashset #array
ADD COMMENT
Topic
Name
4+3 =