What do you want to save?
Add Code snippet
New code examples
-
Java 2021-09-13 17:53:03
java generic type method
// generic methods public <T> List<T> fromArrayToList(T[] a) { return Arrays.stream(a).collect(Collectors.toList()); } public static <T, G> List<G> fromArrayToList(T[] a, Function<T, G> mapperFunction) { retur... Add solution -
PHP 2021-09-13 05:57:02
php csv to array with headers
function parse($file, $separ = ';') { $arrays = array_map(function ($foo) use ($separ) { return array_map("trim", str_getcsv($foo, $separ)); }, file($file, FILE_SKIP_EMPTY_LINES)); $header = $arrays[0]; unset($arrays[0])... Add solution -
Java 2021-09-12 10:31:04
map multiple fields from java stream
private static <T> Predicate<T> distinctByKeys(Function<? super T, ?>... keyExtractors) { final Map<List<?>, Boolean> seen = new ConcurrentHashMap<>(); return t -> &... Add solution -
TypeScript 2021-09-12 07:45:01
Write a function that takes in two sorted arrays and returns a new array with all elements sorted not using array method sort.
// const newSortArrays = (arr1, arr2) => { // let output = []; // while (arr1.length && arr2.length) { // if (arr1[0] < arr2[0]) // output.push(arr1[0] < arr2[0] ? arr1.shift() : arr2.shift()) // } // retur... Add solution -
Python 2021-09-12 01:20:01
python when to use pandas series, numpy ndarrays or simply python dictionaries
# A useful rule of thumb is to use the simplest data structure that still # satisfies your needs. If we rank the data structures from most simple # to least simple, it usually ends up like this: 1. Dictionaries / lists 2. Numpy arrays 3. Pandas series / ... Add solution -
Java 2021-09-10 21:33:02
string array to arraylist
new ArrayList<>(Arrays.asList(array)); Add solution -
Java 2021-09-10 21:10:02
how to find two strings are anagrams in java
import java.util.Arrays; public class AnagramString { static void isAnagram(String str1, String str2) { String s1 = str1.replaceAll("\\s", ""); String s2 = str2.replaceAll("\\s", "");... Add solution -
Other 2021-09-10 05:41:02
enum multiple values
public enum Language{ English("english", "eng", "en", "en_GB", "en_US"), German("german", "de", "ge"), Croatian("croatian", "hr", "cro&quo... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5