Programming Articles - Page 2132 of 3363

Installing Python on Mac OS

Mohd Mohtashim
Updated on 24-Jan-2020 11:06:37

608 Views

Python distribution is available for a wide variety of platforms. You need to download only the binary code applicable for your platform and install Python.If the binary code for your platform is not available, you need a C compiler to compile the source code manually. Compiling the source code offers more flexibility in terms of choice of features that you require in your installation.Recent Macs come with Python installed, but it may be several years out of date. Seehttp://www.python.org/download/mac/ for instructions on getting the current version along with extra tools to support development on the Mac. For older Mac OS's ... Read More

Installing Python on Linux

Mohd Mohtashim
Updated on 24-Jan-2020 11:01:47

633 Views

Python distribution is available for a wide variety of platforms. You need to download only the binary code applicable for your platform and install Python.If the binary code for your platform is not available, you need a C compiler to compile the source code manually. Compiling the source code offers more flexibility in terms of choice of features that you require in your installation.Here are the simple steps to install Python on Unix/Linux machine.Open a Web browser and go to https://www.python.org/downloads/Follow the link to download zipped source code available for Unix/Linux.Download and extract files.Editing the Modules/Setup file if you want to customize ... Read More

Why You Should Learn Python Programming?

Mohd Mohtashim
Updated on 24-Jan-2020 10:58:56

317 Views

Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.Python is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. I will list down some of the key advantages of learning Python −Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL ... Read More

How to implement ToLongBiFunction using lambda expression in Java?

raja
Updated on 14-Jul-2020 13:50:14

276 Views

ToLongBiFunction is a in-built functional interface from java.util.function package. This functional interface accepts two reference type parameters as input and produces a long-valued result. ToLongBiFunction interface can be used as an assignment target for a lambda expression or method reference and contains only one abstract method: applyAsLong().Syntax@FunctionalInterface interface ToLongBiFunction {  long applyAsLong(T t, U u); }Exampleimport java.util.*; import java.util.function.ToLongBiFunction; public class ToLongBiFunctionTest {    public static void main(String[] args) {       ToLongBiFunction getMobileNum = (map, value) -> {    // lambda          if(map != null && !map.isEmpty()) {             if(map.containsKey(value)) {       ... Read More

How to implement ToLongFunction using lambda expression in Java?

raja
Updated on 14-Jul-2020 13:45:09

305 Views

ToLongFunction is a functional interface defined in java.util.function package. This functional interface accepts a reference type as input and produces a long-valued result. ToLongFunction interface can be used as an assignment target for a lambda expression or method reference. It contains only one abstract method: applyAsLong().Syntax@FunctionalInterface interface ToLongFunction {    long applyAsLong(T value); }Exampleimport java.util.*; import java.util.function.ToLongFunction; public class ToLongFunctionTest {    public static void main(String args[]) {       List list = new ArrayList();       list.add("11");       list.add("22");       list.add("33");       list.add("44");       list.add("55");       ToLongFunction function = (String item) -> Long.valueOf(item);  // ... Read More

How to implement ToDoubleBiFunction using lambda expression in Java?

raja
Updated on 14-Jul-2020 13:39:07

334 Views

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 More

How to implement ToIntBiFunction using lambda expression in Java?

raja
Updated on 14-Jul-2020 13:40:19

311 Views

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 multiplication of t and u is: " + test.applyAsInt(10, 7));       System.out.println("The multiplication of t and u is: " ... Read More

How can we sort a Map by both key and value using lambda in Java?

raja
Updated on 14-Jul-2020 13:30:27

1K+ Views

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[]) {             // Sort a Map by their key       Map map = new HashMap(); ... Read More

How to implement LongUnaryOperator using lambda in Java?

raja
Updated on 14-Jul-2020 13:27:20

286 Views

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          long result = longValue * longValue;          System.out.println("Getting square: " + result);   ... Read More

10 Reasons why you should Learn Python

Sharon Christine
Updated on 23-Jan-2020 05:21:27

2K+ Views

Python is a totally free language to download, use, and code. Its commands are mostly in simple English. This makes it easy to remember and write commands. The code is readable and with a little knowledge, a developer can learn many things just by looking at the code.It has standard libraries that offer a lot of functionalities which lets you implement complex applications with ease. Python was designed with the newbies in mind. The use of white space and common expressions has eliminated the need for tedious variable declarations and ugly braces.Your First Steps in ProgrammingPython can be your starting ... Read More

Advertisements