What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-27 16:44:02
flatten nested array javascript
// using recursion, .reduce() and .concat() methods // works with arrays of any depth function flatten(arr) { return arr.reduce((acc, cur) => acc.concat(Array.isArray(cur) ? flatten(cur) : cur), []); }; const arr = [[1,2],[3,[4,[5]]]]; const flatte... Add solution -
Java 2021-09-27 13:13:06
java 8 stream group by example
package com.mkyong.java8; import java.math.BigDecimal; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; public class Java8Examples4 { public static void main(String[] ar... Add solution -
Other 2021-09-27 12:26:04
clear array vba
'In VBA to reset a dynamic array of Longs or Doubles to all zeros, the simplest way 'is to use the Redim() function. It's also extremely fast, roughly four times 'faster than iterating over the array to set each element. Sub Test_ArrayZeroing() Dim ... Add solution -
Other 2021-09-26 07:00:02
java streams
the Stream API is used to process collections of objects. A stream is a sequence of objects that supports various methods which can be pipelined to produce the desired result. It is very similar to build().perform() method in Actions class. It is cha... Add solution -
Other 2021-09-26 00:51:04
typing arrays
// Arrays are variables containing multiple pieces of data. myArray = ["value1", 2, 3, "insert fourth value here"]; // To retrieve data, you reference them via index numbers. // KEEP IN MIND that when referencing array values, index ... Add solution -
C 2021-09-24 23:10:06
array value from user c
#include <stdio.h> int main(void) { int size, i; printf("Enter the size of the arrays:\n"); scanf("%d", &size); int arr1[size]; printf("Enter the elements of the array:\n"); for (i = 0; i < size; i++) { scan... Add solution