What do you want to save?
Add Code snippet
New code examples
-
Java 2022-02-15 14:50:19
how to print the map in java
import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.stream.Stream; class MapUtil { // Program to print all keys present in the Map using keySet() in Java public... Add solution -
TypeScript 2022-02-11 21:20:01
como percorrer um array js
// Requiring the lodash library // src: https://lodash.com/docs/4.17.15#forEach // console: npm i --save lodash const _ = require("lodash") // Use of _.forEach() method _.forEach([1, 2], function(value) { console.log(value) }); // => L... Add solution -
PHP 2021-11-19 18:07:11
php How do you remove an array element in a foreach loop?
Instead of doing foreach() loop on the array, it would be faster to use array_search() to find the proper key. On small arrays, I would go with foreach for better readibility, but for bigger arrays, or often executed code, this should be a bit more optima... Add solution -
Javascript 2021-11-13 13:46:25
create array from htmlcollection
//Use the Array.from() method to convert a nodelist or HTMLcollection into an array. let elements = document.getElementsByClassName("classnameHere"); let arrayOfElements = Array.from(elements); //Now arrayOfElements is iterable with methods su... Add solution -
Java 2021-10-20 15:42:09
lambda expression java
A lambda expression is a short block of code which takes in parameters and returns a value. Lambda expressions are similar to methods, but they do not need a name and they can be implemented right in the body of a method. parameter -> expression To ... Add solution -
Java 2021-10-17 14:36:05
how to use lambda in java
A lambda expression is a short block of code which takes in parameters and returns a value. Lambda expressions are similar to methods, but they do not need a name and they can be implemented right in the body of a method. parameter -> expression To ... Add solution -
TypeScript 2021-10-06 19:07:05
map vs for each
forEach() just loop through the elements. It's throws away return values and always returns undefined.The result of this method does not give us an output . map() loop through the elements allocates memory and stores return values by iterating main array... Add solution -
Javascript 2021-09-26 15:43:02
javascript remove duplicate in two arrays
// 1. filter() function removeDuplicates(array) { return array.filter((a, b) => array.indexOf(a) === b) }; // 2. forEach() function removeDuplicates(array) { let x = {}; array.forEach(function(i) { if(!x[i]) { x[i] = true } }) r... Add solution