Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to implement ToIntBiFunction using lambda expression in Java?
ToIntBiFunction is a built-in functional interface from java.util.function package. This interface accepts two parameters as input and produces an int-valued result. ToIntBiFunction interface can be used as an assignment target for a lambda expression or method reference. It contains only one abstract method: applyAsInt() and doesn't contain any default or static methods.Syntax@FunctionalInterface interface ToIntBiFunction { int applyAsInt(T t, U u); }Exampleimport java.util.function.ToIntBiFunction; public class ToIntBiFunctionTest { public static void main(String args[]) { ToIntBiFunction test = (t, u) -> t * u; System.out.println("The ...
Read MoreHow to implement ToDoubleBiFunction using lambda expression in Java?
ToDoubleBiFunction is a functional interface defined in java.util.function package. This functional interface accepts two parameters as input and produces a double-valued result. ToDoubleBiFunction interface can be used as an assignment target for a lambda expression or method reference. This interface contains only one abstract method: applyAsDouble() and doesn't contain any default or static methods.Syntax@FunctionalInterface interface ToDoubleBiFunction { double applyAsDouble(T t, U u); }Exampleimport java.util.function.ToDoubleBiFunction; public class ToDoubleBiFunctionTest { public static void main(String args[]) { ToDoubleBiFunction test = (t, u) -> t / u; // lambda expression System.out.println("The division of t and u is: " + test.applyAsDouble(50, ...
Read MoreHow can we sort a Map by both key and value using lambda in Java?
A Map interface implements the Collection interface that provides the functionality of the map data structure. A Map doesn't contain any duplicate keys and each key is associated with a single value. We can able to access and modify values using the keys associated with them.In the below two examples, we can able to sort a Map by both key and value with the help of lambda expression.Example for sorting of Map using Keyimport java.util.*; import java.util.stream.*; public class MapSortUsingKeyTest { public static void main(String args[]) { ...
Read MoreHow to implement LongUnaryOperator using lambda in Java?
LongUnaryOperator is a functional interface from java.util.function package. This functional interface accepts a single long-valued operand and produces a long-valued result. LongUnaryOperator interface can be used as an assignment target for lambda expression and method reference. It contains one abstract method: applyAsLong(), one static method: identity() and two default methods: andThen() and compose().Syntax@FunctionalInterface public interface LongUnaryOperator long applyAsLong(long operand); }Exampleimport java.util.function.LongUnaryOperator; public class LongUnaryOperatorTest { public static void main(String args[]) { LongUnaryOperator getSquare = longValue -> { // lambda ...
Read MoreHow to find your Current Wifi Password and Secure it?
Do you see your devices connected to your Wifi-network, but presently are you are facing problem recollecting your Wifi password, which you have previously used and connected all your devices with your Wifi network.The reason as to why you may have forgotten your Wifi password is, you would have clicked on the box, which states remember the password. This helps you escape the pain of entering your password every time when you login to your device. Days would have passed and you might not remember what password you have kept for your Wifi-Network. Another reason, as to why many people ...
Read MoreHow to Hide Data on your Smartphone
Your smartphone is your personal device which stores many of your personal files and data. There may be several reasons you would want to hide your data which includes private photos, videos and messages. If you want to hide a file from prying eyes on your smartphone, then it’s incredibly important that you can learn some methods for hiding files or folders so that you can properly store and sort files as needed.There are ways you can hide files on your phone with ease. Some of these methods don’t need any apps while some of them include various apps which ...
Read MoreHow to Track Lost Smartphone with Google?
We live in an era in which we can do a lot more than just calling with our phones, hence the name ‘smartphones’. Calling, messaging, clock, calculator, these were just the mere facilities of the older generation. Now these gadgets can do so much more! Loads of apps, games, e-books, etc. are available to the customer for entertainment and education.Smartphones being such an important part of our lives now, containing so much of our private information have had a huge impact. But what if your phone is lost, well that’s exactly where this article kicks in!We have two different methods ...
Read MoreHow to Secure The SSHD Using Fail2Ban on RHEL 7.x/CentOS 7.x
In this article, we will learn how to install and configure to secure the SSH connection using Fail2ban on CentOS 7, as we all get connected to the servers using the SSH which is secured and SSH will get exposed to the internet to work properly, there may be a risk of being targeted in this way, if we see the logs for these services. We often see the repeated logins using the brute-force attacks.Installing the Fail2banAs the Fail2ban is not available in the official CentOS repository, we need to update and install the package using EPEL project, then we ...
Read MoreHow to access variables from enclosing class using lambda in Java?
The variables defined by the enclosing scope of a lambda expression can be accessible within the lambda expression. A lambda expression can access to both instance, static variables and methods defined by the enclosing class. It has also access to "this" variable (both implicitly and explicitly) that can be an instance of enclosing class. The lambda expression also sets the value of an instance or static variable.Exampleinterface SimpleInterface { int func(); } public class SimpleLambdaTest { static int x = 50; public static void main(String[] args) { ...
Read MoreHow to implement DoubleUnaryOperator using lambda and method reference in Java?
DoubleUnaryOperator is a functional interface defined in java.util.function package. This functional interface expects a parameter of type double as input but produces the output of the same type. DoubleUnaryOperator interface can be used as an assignment target for lambda expression and method reference. This interface contains one abstract method: applyAsDouble(), one static method: identity() and two default methods: andThen() and compose().Syntax@FunctionalInterface public interface DoubleUnaryOperator { double applyAsDouble(double operand); }Example of Lambda Expressionimport java.util.function.DoubleUnaryOperator; public class DoubleUnaryOperatorTest1 { public static void main(String[] args) { DoubleUnaryOperator getDoubleValue = doubleValue -> { // ...
Read More