let message = ‘helloWorld’ let convertedMessage=message.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`); console.log(convertedMessage); output -> hello_world
Most Used Java Stream Map Functions
Retriving a List of attribute (field) values from a Object List (Array List) List users=new ArrayList<>(); List userIds=users .stream() .map(u->u.getId()) .collect(Collectors.toList()); Filter Objects by Attribute in a Array List List users=new ArrayList<>(); List filteredUsers=users .stream() .filter(u->u.getId().equals(1l)) .collect(Collectors.toList()); Check if All Values of a Array List Matches a Cirtain Condition checking if all the users in […]
Javascript For Loops
Javascript For Loops in the ECMA Standard Simple For Loop The simplest type of for loop increments a variable as its iteration method. The variable acts as a counter for every “n”th element within an object. for (let i = 0; i < array.length; i++) { console.log(array[i]); } The loop could also be written in […]