Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java convert array to another type

import java.util.Arrays;

int[] arr = {1, 2, 3, 4};

// convertions
Object[] a = Arrays.stream(arr).mapToObj(i -> i).toArray();
Double[] b = Arrays.stream(arr).mapToDouble(i -> i).toArray();
Long[] c = Arrays.stream(arr).mapToLong(i -> i).toArray();
 
PREVIOUS NEXT
Tagged: #java #convert #array #type
ADD COMMENT
Topic
Name
4+3 =